Commit 22bb38f4 authored by xin's avatar xin
Browse files

modify header keyword and some value; fix spec bug, shift 1 pixel

parent 379dedfb
...@@ -332,7 +332,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec ...@@ -332,7 +332,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec
h_prim['TIME'] = time_obs[0:2]+':'+time_obs[2:4]+':'+time_obs[4:6] h_prim['TIME'] = time_obs[0:2]+':'+time_obs[2:4]+':'+time_obs[4:6]
h_prim['DATE-OBS'] = '20'+date[0:2]+'-' + date[2:4]+'-'+date[4:6] h_prim['DATE-OBS'] = '20'+date[0:2]+'-' + date[2:4]+'-'+date[4:6]
h_prim['TIME-OBS'] = time_obs[0:2]+':'+time_obs[2:4]+':'+time_obs[4:6] h_prim['TIME-OBS'] = time_obs[0:2]+':'+time_obs[2:4]+':'+time_obs[4:6]
h_prim['DETECTOR'] = 'CCD'+CCDID[k-1].rjust(2,'0') h_prim['DETECTOR'] = 'CHIP'+CCDID[k-1].rjust(2,'0')
h_prim['RA_OBJ'] = ra h_prim['RA_OBJ'] = ra
h_prim['DEC_OBJ'] = dec h_prim['DEC_OBJ'] = dec
h_prim['OBJECT'] = '1'+ pointNum.rjust(8,'0') h_prim['OBJECT'] = '1'+ pointNum.rjust(8,'0')
...@@ -341,8 +341,8 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec ...@@ -341,8 +341,8 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec
h_prim['EXPTIME'] = exptime h_prim['EXPTIME'] = exptime
# Define file types # Define file types
file_type = {'SCI':'sci', 'BIAS':'zero', 'DARK':'dark', 'FLAT':'flat', 'CRS':'cosmic_ray', 'CRD':'cosmic_ray'} file_type = {'SCI':'sci', 'BIAS':'bias', 'DARK':'dark', 'FLAT':'flat', 'CRS':'cosmic_ray', 'CRD':'cosmic_ray'}
h_prim['FILETYPE'] = file_type[im_type] h_prim['OBSTYPE'] = file_type[im_type]
co = coord.SkyCoord(ra, dec, unit='deg') co = coord.SkyCoord(ra, dec, unit='deg')
......
XTENSION= 'IMAGE ' / Image extension BITPIX = 16 / array data type NAXIS = 2 / number of array dimensions NAXIS1 = 9216 / length of first array axis NAXIS2 = 9232 / length of second array axis PCOUNT = 0 GCOUNT = 1 EXTNAME = 'SCI ' EXTVER = 1 BSCALE = 1 BZERO = 32768 BUNIT = 'ADU ' COMMENT ================================================================== COMMENT CCD chip information COMMENT ================================================================== NCHAN = 16 / Number of readout channels NCHAN1 = 8 / Number of horizintal channels NCHAN2 = 2 / Number of vertical channels DETSIZE = '[1:9216:9232]' / detector size BIASSEC = '[9216:9217,9232:9234]' / bias section CCDCHIP = 6 / CCD chip ID CCDLABEL= 'y-1 ' / CCD chip label PSCAN1 = 27 / horizontal prescan width PSCAN2 = 8 / vertical prescan height OSCAN1 = 16 / horizontal overscan width OSCAN2 = 8 / vertical overscan height FILTER = 'y ' / filter name COMMENT ================================================================== COMMENT WORLD COORDINATE SYSTEM AND RELATED PARAMETERS COMMENT ================================================================== WCSDIM = 2 / Number of World Coordinate System axes EQUINOX = 2000.0 / Epoch (year) CRPIX1 = -10017.0 / Coordinate reference pixel of x CRPIX2 = 24876.0 / Coordinate reference pixel of y CRVAL1 = 62.228226 / Coordinate reference value of x CRVAL2 = -42.316932 / Coordinate reference value of y CTYPE1 = 'RA---TAN' / the coordinate type CTYPE2 = 'DEC--TAN' / the coordinate type CD1_1 = 1.88602083707394E-05 / partial of first axis coordinate of x CD2_1 = -8.1745583617600E-06 / partial of first axis coordinate of y CD1_2 = 8.17455836176000E-06 / partial of second axis coordinate of x CD2_2 = 1.88602083707394E-05 / partial of second axis coordinate of y POS_ANG = 30.0 / Positon angle of detector array COMMENT ================================================================== COMMENT Readout information COMMENT ================================================================== GAIN1 = 1.1 / CCD gain RDNOISE1= 5.0 / read noise READTIME= 40.0 / read time (sec) RDSPEED = 10.0 / read speed (in MHz) CHIPTEMP= -100.0 / chip temperature (in K) COMMENT ================================================================== COMMENT Other information COMMENT ================================================================== CHECKSUM= '''abcde''' / SHA256 checksum of global headers END XTENSION= 'IMAGE ' / Image extension BITPIX = 16 / array data type NAXIS = 2 / number of array dimensions NAXIS1 = 9216 / length of first array axis NAXIS2 = 9232 / length of second array axis PCOUNT = 0 GCOUNT = 1 EXTNAME = 'SCI ' EXTVER = 1 BSCALE = 1 BZERO = 32768 BUNIT = 'ADU ' COMMENT ================================================================== COMMENT CCD chip information COMMENT ================================================================== NCHAN = 16 / Number of readout channels NCHAN1 = 8 / Number of horizintal channels NCHAN2 = 2 / Number of vertical channels DETSIZE = '[1:9216:9232]' / detector size BIASSEC = '[9216:9217,9232:9234]' / bias section CCDCHIP = 6 / CCD chip ID CCDLABEL= 'y-1 ' / CCD chip label PSCAN1 = 27 / horizontal prescan width PSCAN2 = 8 / vertical prescan height OSCAN1 = 16 / horizontal overscan width OSCAN2 = 8 / vertical overscan height FILTER = 'y ' / filter name COMMENT ================================================================== COMMENT WORLD COORDINATE SYSTEM AND RELATED PARAMETERS COMMENT ================================================================== WCSDIM = 2 / Number of World Coordinate System axes EQUINOX = 2000.0 / Epoch (year) CRPIX1 = -10017.0 / Coordinate reference pixel of x CRPIX2 = 24876.0 / Coordinate reference pixel of y CRVAL1 = 62.228226 / Coordinate reference value of x CRVAL2 = -42.316932 / Coordinate reference value of y CTYPE1 = 'RA---TAN' / the coordinate type CTYPE2 = 'DEC--TAN' / the coordinate type CD1_1 = 1.88602083707394E-05 / partial of first axis coordinate of x CD2_1 = -8.1745583617600E-06 / partial of first axis coordinate of y CD1_2 = 8.17455836176000E-06 / partial of second axis coordinate of x CD2_2 = 1.88602083707394E-05 / partial of second axis coordinate of y POS_ANG = 30.0 / Positon angle of detector array COMMENT ================================================================== COMMENT Readout information COMMENT ================================================================== GAIN1 = 1.1 / CCD gain RDNOISE1= 5.0 / read noise READTIME= 40.0 / read time (sec) RDSPEED = 10.0 / read speed (in MHz) CHIPTEMP= 173.0 / chip temperature (in K) COMMENT ================================================================== COMMENT Other information COMMENT ================================================================== CHECKSUM= '''abcde''' / SHA256 checksum of global headers END
...@@ -313,7 +313,9 @@ class Chip(FocalPlane): ...@@ -313,7 +313,9 @@ class Chip(FocalPlane):
time_obs=time_obs, time_obs=time_obs,
exptime=exptime) exptime=exptime)
hdu1 = fits.PrimaryHDU(header=h_prim) hdu1 = fits.PrimaryHDU(header=h_prim)
hdu1.add_checksum()
hdu2 = fits.ImageHDU(img.array, header=h_ext) hdu2 = fits.ImageHDU(img.array, header=h_ext)
hdu2.add_checksum()
hdu1 = fits.HDUList([hdu1, hdu2]) hdu1 = fits.HDUList([hdu1, hdu2])
fname = os.path.join(output_dir, h_prim['FILENAME']+'.fits') fname = os.path.join(output_dir, h_prim['FILENAME']+'.fits')
hdu1.writeto(fname, output_verify='ignore', overwrite=True) hdu1.writeto(fname, output_verify='ignore', overwrite=True)
......
...@@ -306,7 +306,7 @@ class Galaxy(MockObject): ...@@ -306,7 +306,7 @@ class Galaxy(MockObject):
gal = gal.shear(gal_shear) gal = gal.shear(gal_shear)
gal = galsim.Convolve(psf, gal) gal = galsim.Convolve(psf, gal)
starImg = gal.drawImage(wcs=real_wcs_local) starImg = gal.drawImage(wcs=real_wcs_local, offset=offset)
origin_star = [y_nominal - (starImg.center.y - starImg.ymin), origin_star = [y_nominal - (starImg.center.y - starImg.ymin),
x_nominal - (starImg.center.x - starImg.xmin)] x_nominal - (starImg.center.x - starImg.xmin)]
......
...@@ -354,7 +354,7 @@ class MockObject(object): ...@@ -354,7 +354,7 @@ class MockObject(object):
star = galsim.DeltaFunction(gsparams=gsp) star = galsim.DeltaFunction(gsparams=gsp)
star = star.withFlux(tel.pupil_area * exptime) star = star.withFlux(tel.pupil_area * exptime)
star = galsim.Convolve(psf, star) star = galsim.Convolve(psf, star)
starImg = star.drawImage(nx=100, ny=100, wcs=real_wcs_local) starImg = star.drawImage(nx=100, ny=100, wcs=real_wcs_local, offset=offset)
origin_star = [y_nominal - (starImg.center.y - starImg.ymin), origin_star = [y_nominal - (starImg.center.y - starImg.ymin),
x_nominal - (starImg.center.x - starImg.xmin)] x_nominal - (starImg.center.x - starImg.xmin)]
......
...@@ -185,8 +185,8 @@ class SpecDisperser(object): ...@@ -185,8 +185,8 @@ class SpecDisperser(object):
origin_in[1] = self.origin[1] origin_in[1] = self.origin[1]
dx0_in = dx[0] dx0_in = dx[0]
dy0_in = dyc[0] dy0_in = dyc[0]
originOut_x = origin_in[1] + dx0_in - 1 originOut_x = origin_in[1] + dx0_in
originOut_y = origin_in[0] + dy0_in - 1 originOut_y = origin_in[0] + dy0_in
if self.flat_cube is None: if self.flat_cube is None:
beam_flat = None beam_flat = None
......
...@@ -398,7 +398,9 @@ class Observation(object): ...@@ -398,7 +398,9 @@ class Observation(object):
extName='raw') extName='raw')
chip.img = galsim.Image(chip.img.array, dtype=np.uint16) chip.img = galsim.Image(chip.img.array, dtype=np.uint16)
hdu1 = fits.PrimaryHDU(header=h_prim) hdu1 = fits.PrimaryHDU(header=h_prim)
hdu1.add_checksum()
hdu2 = fits.ImageHDU(chip.img.array, header=h_ext) hdu2 = fits.ImageHDU(chip.img.array, header=h_ext)
hdu2.add_checksum()
hdu1 = fits.HDUList([hdu1, hdu2]) hdu1 = fits.HDUList([hdu1, hdu2])
fname = os.path.join(chip_output.subdir, h_prim['FILENAME'] + '.fits') fname = os.path.join(chip_output.subdir, h_prim['FILENAME'] + '.fits')
hdu1.writeto(fname, output_verify='ignore', overwrite=True) hdu1.writeto(fname, output_verify='ignore', overwrite=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment