reproject icon indicating copy to clipboard operation
reproject copied to clipboard

Saving mosaic image as a fits file with appropriate header.

Open TrystanScottLambert opened this issue 1 year ago • 2 comments

Hi.

I wonder if there is a way to save the optimum wcs and the array as a fits image without copying the header of one of the fits file images?

We have data which contains 8 different ccds that we want to mosaic together. We can plot the outputted array in matplotlib which seems to work fine. However when trying to save this as a fits file then the documentation seems to want to do something along the lines of taking one of the headers and using that when writing the fits file. But in this case that would result in chip specific information being used for the entire mosaic image.

Does reproject have a method to write a combined header object in some way which includes the optimum wcs? If not, would it be a feasible addition? And would the current correct method be to create a new header object from scratch?

TrystanScottLambert avatar Apr 25 '23 13:04 TrystanScottLambert

You should be able to convert the optimum WCS to a header by using wcs.to_header() and pass that to the FITS writing code. If that doesn't work, could you show what your code looks like at the moment?

astrofrog avatar Apr 25 '23 14:04 astrofrog

Thanks for the response. From my understanding wcs.to_header() only writes the wcs information as a header and then we loose any telescope related header data. I was thinking of something similar to the header that SWARP might give. Like the NAXIS1/2, gain, saturation and a tag saying that the fits file was combined using reproject. Something like that.

TrystanScottLambert avatar Apr 25 '23 16:04 TrystanScottLambert