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
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['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['DEC_OBJ'] = dec
h_prim['OBJECT'] = '1'+ pointNum.rjust(8,'0')
......@@ -341,8 +341,8 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec
h_prim['EXPTIME'] = exptime
# Define file types
file_type = {'SCI':'sci', 'BIAS':'zero', 'DARK':'dark', 'FLAT':'flat', 'CRS':'cosmic_ray', 'CRD':'cosmic_ray'}
h_prim['FILETYPE'] = file_type[im_type]
file_type = {'SCI':'sci', 'BIAS':'bias', 'DARK':'dark', 'FLAT':'flat', 'CRS':'cosmic_ray', 'CRD':'cosmic_ray'}
h_prim['OBSTYPE'] = file_type[im_type]
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
SIMPLE = T / conforms to FITS standard BITPIX = 8 / array data type NAXIS = 0 / number of array dimensions EXTEND = T NEXTEND = 1 GROUPS = F DATE = '2021-03-04' / Date this file was written TIME = '09:30:00' / Time this file was written FILENAME= 'MSC_MS_210304093000_100000000_06_raw' / Name of file FILETYPE= 'sci ' / type of data found in data data file TELESCOP= 'CSST ' / telescope used to acquire data INSTRUME= 'MSC ' / identifier for instrument used to acquire data RADECSYS= 'ICRS ' / frame of reference of coordinates EQUINOX = 2000.0 / Default equinox COMMENT ================================================================== COMMENT Object information COMMENT ================================================================== OBJECT = '00000000' / name of the object observed TARGET = '+000000000000' / Name of the target (RA & Dec of the object) OBSID = '00000000' / ID of this observation RA_OBJ = 62.228226 / R.A. of the object (degrees) DEC_OBJ = -42.316932 / declination of the object (degrees) COMMENT ================================================================== COMMENT Exposure information COMMENT ================================================================== SUNANGLE= 30.0 / angle between sun and direction perpendicular MOONANGL= 30.0 / angle between moon and direction perpendicular SUN_ALT = 30.0 / Sun altitude REFFRAME= 'CSSTGSC-1.0' / guide star catalog version DATE-OBS= '2021-03-04' / UTC date of start of observation (yyyy-mm-dd) TIME-OBS= '09:30:00' / UTC time of start of observation (hh:mm:ss) EXPSTART= 58849.0 / exposure start time (MJD) EXPEND = 58849.0 / exposure end time (MJD) EXPTIME = 150.0 / exposure duration EPOCH = 2021.0 / coordinate epoch COMMENT ================================================================== COMMENT Detector information COMMENT ================================================================== DETECTOR= 'CCD06 ' / deterctor name PIXSCAL1= 0.074 / Pixel scale for axis 1 PIXSCAL2= 0.074 / Pixel scale for axis 2 PIXSIZE1= 9216.0 / Pixel size for axis 1 PIXSIZE2= 9232.0 / Pixel size for aixs 2 CCDTEMP = -100.0 / CCD chip / dewar temperature (in K) COMMENT ================================================================== COMMENT Telescope information COMMENT ================================================================== TELSTAT = T / Tracking status TELTEMP1= -100.0 / Telescope temperature (in K) POSI0_X = 0.0 / The orbital position in X (shuttr open) POSI0_Y = 0.0 / The orbital position in Y (shuttr open) POSI0_Z = 0.0 / The orbital position in Z (shuttr open) VELO0_X = 0.0 / The orbital velocity in X (shuttr open) VELO0_Y = 0.0 / The orbital velocity in Y (shuttr open) VELO0_Z = 0.0 / The orbital velocity in Z (shuttr open) RA_PNT0 = '00:00:00.00' / R.A. at shutter open time DEC_PNT0= '00:00:00.00' / declination at shutter open time POSI1_X = 0.0 / The orbital position in X (shuttr close) POSI1_Y = 0.0 / The orbital position in Y (shuttr close) POSI1_Z = 0.0 / The orbital position in Z (shuttr close) VELO1_X = 0.0 / The orbital velocity in X (shuttr close) VELO1_Y = 0.0 / The orbital velocity in Y (shuttr close) VELO1_Z = 0.0 / The orbital velocity in Z (shuttr close) RA_PNT1 = 0.0 / R.A. at shutter close time DEC_PNT1= 0.0 / declination at shutter close time RA_NOM = '00:00:00.00' / nominal proposed R.A. of the pointing DEC_NOM = '00:00:00.00' / nominal proposed DEC of the pointing TELFOCUS= 'abcdefg ' / telescope focus AOSTAT = T / Active opticas status HOODSTAT= T / Lens hood status COMMENT ================================================================== COMMENT Shutter information COMMENT ================================================================== SHUTHWV = 'shutter-h-1.0' / shutter hardware version SHUTSWV = 'shutter-s-1.0' / shutter software version SHUTSTAT= T / shutter status SHTOPEN0= 0.0 / shutter open time (begin) SHTOPEN1= 0.0 / shutter open time (end) SHTCLOS0= 0.0 / shutter close time (begin) SHTCLOS1= 0.0 / shutter close time (end) COMMENT ================================================================== COMMENT Guide information COMMENT ================================================================== STARNO1 = 1.0 / guide star number STARPOX1= 0.0 / guide star average position STARPOY1= 0.0 / guide star average position SECMOM1 = 0.0 / guide star second momentum GAFLAG1 = T / guide flag indicate whether adjust position STARNO2 = 1.0 / guide star number STARPOX2= 0.0 / guide star average position STARPOY2= 0.0 / guide star average position SECMOM2 = 0.0 / guide star second momentum GAFLAG2 = T / guide flag indicate whether adjust position STARNO3 = 1.0 / guide star number STARPOX3= 0.0 / guide star average position STARPOY3= 0.0 / guide star average position SECMOM3 = 0.0 / guide star second momentum GAFLAG3 = T / guide flag indicate whether adjust position STARNO4 = 1.0 / guide star number STARPOX4= 0.0 / guide star average position STARPOY4= 0.0 / guide star average position SECMOM4 = 0.0 / guide star second momentum GAFLAG4 = T / guide flag indicate whether adjust position COMMENT ================================================================== COMMENT LED information COMMENT ================================================================== LEDSTAT1= '0000000000000000000000000000' / LED status LEDEXP1 = 0.0 / LED flash time (second) LEDSTAT2= '0000000000000000000000000000' / LED status LEDEXP2 = 0.0 / LED flash time (second) LEDTEMPA= -100.0 / LED temperature (main LED in K) LEDTEMPB= -100.0 / LED temperature (backup LED in K) COMMENT ================================================================== COMMENT Other information COMMENT ================================================================== CHECKSUM= 'abcdefg ' / SHA256 checksum of global headers END
SIMPLE = T / conforms to FITS standard BITPIX = 8 / array data type NAXIS = 0 / number of array dimensions EXTEND = T NEXTEND = 1 GROUPS = F DATE = '2021-03-04' / Date this file was written TIME = '09:30:00' / Time this file was written FILENAME= 'MSC_MS_210304093000_100000000_06_raw' / Name of file OBSTYPE = 'sci ' / type of data found in data data file TELESCOP= 'CSST ' / telescope used to acquire data INSTRUME= 'MSC ' / identifier for instrument used to acquire data RADECSYS= 'ICRS ' / frame of reference of coordinates EQUINOX = 2000.0 / Default equinox COMMENT ================================================================== COMMENT Object information COMMENT ================================================================== OBJECT = '00000000' / name of the object observed TARGET = '+000000000000' / Name of the target (RA & Dec of the object) OBSID = '00000000' / ID of this observation RA_OBJ = 62.228226 / R.A. of the object (degrees) DEC_OBJ = -42.316932 / declination of the object (degrees) COMMENT ================================================================== COMMENT Exposure information COMMENT ================================================================== SUNANGLE= 30.0 / angle between sun and direction perpendicular MOONANGL= 30.0 / angle between moon and direction perpendicular SUN_ALT = 30.0 / Sun altitude REFFRAME= 'CSSTGSC-1.0' / guide star catalog version DATE-OBS= '2021-03-04' / UTC date of start of observation (yyyy-mm-dd) TIME-OBS= '09:30:00' / UTC time of start of observation (hh:mm:ss) EXPSTART= 58849.0 / exposure start time (MJD) EXPEND = 58849.0 / exposure end time (MJD) EXPTIME = 150.0 / exposure duration EPOCH = 2021.0 / coordinate epoch COMMENT ================================================================== COMMENT Detector information COMMENT ================================================================== DETECTOR= 'CCD06 ' / deterctor name PIXSCAL1= 0.074 / Pixel scale for axis 1 PIXSCAL2= 0.074 / Pixel scale for axis 2 PIXSIZE1= 9216.0 / Pixel size for axis 1 PIXSIZE2= 9232.0 / Pixel size for aixs 2 CHIPTEMP= 173.0 / CCD chip / dewar temperature (in K) COMMENT ================================================================== COMMENT Telescope information COMMENT ================================================================== TELSTAT = T / Tracking status TELTEMP1= -100.0 / Telescope temperature (in K) POSI0_X = 0.0 / The orbital position in X (shuttr open) POSI0_Y = 0.0 / The orbital position in Y (shuttr open) POSI0_Z = 0.0 / The orbital position in Z (shuttr open) VELO0_X = 0.0 / The orbital velocity in X (shuttr open) VELO0_Y = 0.0 / The orbital velocity in Y (shuttr open) VELO0_Z = 0.0 / The orbital velocity in Z (shuttr open) RA_PNT0 = '00:00:00.00' / R.A. at shutter open time DEC_PNT0= '00:00:00.00' / declination at shutter open time POSI1_X = 0.0 / The orbital position in X (shuttr close) POSI1_Y = 0.0 / The orbital position in Y (shuttr close) POSI1_Z = 0.0 / The orbital position in Z (shuttr close) VELO1_X = 0.0 / The orbital velocity in X (shuttr close) VELO1_Y = 0.0 / The orbital velocity in Y (shuttr close) VELO1_Z = 0.0 / The orbital velocity in Z (shuttr close) RA_PNT1 = 0.0 / R.A. at shutter close time DEC_PNT1= 0.0 / declination at shutter close time RA_NOM = '00:00:00.00' / nominal proposed R.A. of the pointing DEC_NOM = '00:00:00.00' / nominal proposed DEC of the pointing TELFOCUS= 'abcdefg ' / telescope focus AOSTAT = T / Active opticas status HOODSTAT= T / Lens hood status COMMENT ================================================================== COMMENT Shutter information COMMENT ================================================================== SHUTHWV = 'shutter-h-1.0' / shutter hardware version SHUTSWV = 'shutter-s-1.0' / shutter software version SHUTSTAT= T / shutter status SHTOPEN0= 0.0 / shutter open time (begin) SHTOPEN1= 0.0 / shutter open time (end) SHTCLOS0= 0.0 / shutter close time (begin) SHTCLOS1= 0.0 / shutter close time (end) COMMENT ================================================================== COMMENT Guide information COMMENT ================================================================== STARNO1 = 1.0 / guide star number STARPOX1= 0.0 / guide star average position STARPOY1= 0.0 / guide star average position SECMOM1 = 0.0 / guide star second momentum GAFLAG1 = T / guide flag indicate whether adjust position STARNO2 = 1.0 / guide star number STARPOX2= 0.0 / guide star average position STARPOY2= 0.0 / guide star average position SECMOM2 = 0.0 / guide star second momentum GAFLAG2 = T / guide flag indicate whether adjust position STARNO3 = 1.0 / guide star number STARPOX3= 0.0 / guide star average position STARPOY3= 0.0 / guide star average position SECMOM3 = 0.0 / guide star second momentum GAFLAG3 = T / guide flag indicate whether adjust position STARNO4 = 1.0 / guide star number STARPOX4= 0.0 / guide star average position STARPOY4= 0.0 / guide star average position SECMOM4 = 0.0 / guide star second momentum GAFLAG4 = T / guide flag indicate whether adjust position COMMENT ================================================================== COMMENT LED information COMMENT ================================================================== LEDSTAT1= '0000000000000000000000000000' / LED status LEDEXP1 = 0.0 / LED flash time (second) LEDSTAT2= '0000000000000000000000000000' / LED status LEDEXP2 = 0.0 / LED flash time (second) LEDTEMPA= -100.0 / LED temperature (main LED in K) LEDTEMPB= -100.0 / LED temperature (backup LED in K) COMMENT ================================================================== COMMENT Other information COMMENT ================================================================== CHECKSUM= 'abcdefg ' / SHA256 checksum of global headers END
......@@ -313,7 +313,9 @@ class Chip(FocalPlane):
time_obs=time_obs,
exptime=exptime)
hdu1 = fits.PrimaryHDU(header=h_prim)
hdu1.add_checksum()
hdu2 = fits.ImageHDU(img.array, header=h_ext)
hdu2.add_checksum()
hdu1 = fits.HDUList([hdu1, hdu2])
fname = os.path.join(output_dir, h_prim['FILENAME']+'.fits')
hdu1.writeto(fname, output_verify='ignore', overwrite=True)
......
......@@ -306,7 +306,7 @@ class Galaxy(MockObject):
gal = gal.shear(gal_shear)
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),
x_nominal - (starImg.center.x - starImg.xmin)]
......
......@@ -354,7 +354,7 @@ class MockObject(object):
star = galsim.DeltaFunction(gsparams=gsp)
star = star.withFlux(tel.pupil_area * exptime)
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),
x_nominal - (starImg.center.x - starImg.xmin)]
......
......@@ -185,8 +185,8 @@ class SpecDisperser(object):
origin_in[1] = self.origin[1]
dx0_in = dx[0]
dy0_in = dyc[0]
originOut_x = origin_in[1] + dx0_in - 1
originOut_y = origin_in[0] + dy0_in - 1
originOut_x = origin_in[1] + dx0_in
originOut_y = origin_in[0] + dy0_in
if self.flat_cube is None:
beam_flat = None
......
......@@ -398,7 +398,9 @@ class Observation(object):
extName='raw')
chip.img = galsim.Image(chip.img.array, dtype=np.uint16)
hdu1 = fits.PrimaryHDU(header=h_prim)
hdu1.add_checksum()
hdu2 = fits.ImageHDU(chip.img.array, header=h_ext)
hdu2.add_checksum()
hdu1 = fits.HDUList([hdu1, hdu2])
fname = os.path.join(chip_output.subdir, h_prim['FILENAME'] + '.fits')
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