@@ -170,46 +170,9 @@ def _writeASDF(self, config, base, image, fname_path, logger):
170170
171171 # use astropy.io.fits.header.Header form of header: required in wcs_from_fits_header
172172 wcs_header = image .wcs .header .header
173- # Don't remove, these are needed to create gwcs object.
174- ny , nx = image .array .shape
175- wcs_header ["NAXIS" ] = 2 # number of axes
176- wcs_header ["NAXIS1" ] = nx # image width in pixels
177- wcs_header ["NAXIS2" ] = ny # image height in pixels
178-
179- # already assigned, redundant repetition?
180- # coordinate type
181- # wcs_header['CTYPE1'] = 'RA---TAN-SIP'
182- # wcs_header['CTYPE2'] = 'DEC--TAN-SIP'
183-
184- # already assigned, redundant repetition, but conversion to int is required
185- # comment/delete this block if float is fine. This too is a repetition again.
186- # reference pixel
187- # wcs_header['CRPIX1'] = nx/2
188- # wcs_header['CRPIX2'] = ny/2
189- # Is the repetition really needed? already defined! but default value differs from assigned.
190- # reference coordinates
191- # wcs_header['CRVAL1'] = base['world_center'].ra.deg
192- # wcs_header['CRVAL2'] = base['world_center'].dec.deg
193-
194- # Agreed with Arun to remove this part. Keeping commented for now.
195- # I can't find these information
196- # (I think they are also connected to border_ref_pix_left etc) so comment below out
197- # - the wcs is not correct without these info
198- # linear transformation: pixel scale in deg/pixel
199- # scale = 0.1 / 3600.0
200- # if the image has rotation wrt constant ra and dec
201- # wcs_header['CD1_1'] = -scale
202- # wcs_header['CD1_2'] = 0.0
203- # wcs_header['CD2_1'] = 0.0
204- # wcs_header['CD2_2'] = scale
205-
206- # coordinate system
207- wcs_header .update ([("RADESYS" , "ICRS" , "Reference Coordinate System" )])
208- # also already defined
209- # wcs_header['LONPOLE'] = 180.0
210-
211- # changing the instrument name from WFC -> WFI, OK?
212- wcs_header ["INSTRUME" ] = "WFI"
173+ # Galsim uses to headers, one in the image and one in the WCS. We need to combine them to get the
174+ # full information.
175+ wcs_header .update (image .header )
213176
214177 tree = ImageModel .create_fake_data ()
215178
0 commit comments