These are chat archives for astropy/astropy

Mar 2019
Mar 27 19:27
SuperMcFreaky on Freenode Hi All. I've got a question about handling FITS files with io.fits
SuperMcFreaky on Freenode Is there a way to convert a PrimaryHDU object to an ImageHDU object?
SuperMcFreaky on Freenode I can do i = fits.ImageHDU(, header=primary.header)
SuperMcFreaky on Freenode and that works, but it copies the data into memory, which can be a real problem in my case
Mar 27 20:37
astrofrog ( Just to check, why do you need to do this?
Mar 27 20:59
SuperMcFreaky on Freenode I have a large collection of single-HDU FITS files that get collected into a custom data object
SuperMcFreaky on Freenode for debugging purposes it is sometimes useful to write this aggregate object as a single FITS file
SuperMcFreaky on Freenode and an HDUList with all PrimaryHDUs produces a non-compliant FITS file
SuperMcFreaky on Freenode it won't even write unless I set output_verify='ignore|warn" in the call to .writeto()
astrofrog ( interesting, I would have thought an HDUList of PrimaryHDU would do the right thing
astrofrog ( it might be worth opening an issue in the GitHub repo to ask whether astropy could be smarter about auto-converting to ImageHDU when writing, we definitely shouldn't be writing files that don't comply with the standard
astrofrog ( I'm not sure how to avoid the copy, if you join the astropy Slack team there is a #fits channel where you could ask
SuperMcFreaky on Freenode well, it won't do that unless I tell it that I'm OK with a non-standard file
Mar 27 21:05
SuperMcFreaky on Freenode ok, I had thought about opening an issue on GitHub but I figured I'd check here first to make sure I wasn't missing something obvious
SuperMcFreaky on Freenode I feel like the capability should/could be there because io.fits already is really good about using memmap, etc.
SuperMcFreaky on Freenode for example, if I open 1000 files with large ImageHDUs and put them together in a new HDUList and write that to disk then they data never enters memory
SuperMcFreaky on Freenode which is exactly what I want, except for PrimaryHDUs
saimn I don't think that the data is copied if it is a numpy array, but maybe it needs to be copied because it is memmmaped