Skip to content

Commit 6a990de

Browse files
Merge pull request #97 from DukeCosmology/move_header
Move header updates to sca.py
2 parents 052c22d + c91577f commit 6a990de

2 files changed

Lines changed: 10 additions & 40 deletions

File tree

roman_imsim/output_asdf.py

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -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

roman_imsim/sca.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ def buildImage(self, config, base, image_num, obj_num, logger):
103103
full_image.header["VERSION"] = version("roman_imsim")
104104
except PackageNotFoundError:
105105
full_image.header["VERSION"] = "unknown"
106+
# Some of these should be in the WCS creation but it will be changed in the future so we leave it
107+
# here for now.
108+
full_image.header["NAXIS"] = 2
109+
full_image.header["NAXIS1"] = full_xsize
110+
full_image.header["NAXIS2"] = full_ysize
111+
full_image.header["RADESYS"] = "ICRS"
106112
full_image.header["SCA"] = self.sca
113+
full_image.header["INSTRUME"] = "WFI"
107114
full_image.header["EXPTIME"] = self.exptime
108115
full_image.header["MJD-OBS"] = self.mjd
109116
full_image.header["DATE-OBS"] = Time(self.mjd, format="mjd").datetime.isoformat()

0 commit comments

Comments
 (0)