Loading ObservationSim/Config/Header/ImageHeader.py +60 −40 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,10 @@ from astropy.wcs.utils import fit_wcs_from_points from astropy.time import Time from astropy.time import Time from astropy import wcs from astropy import wcs from datetime import datetime # import socket import platform def chara2digit(char): def chara2digit(char): """ Function to judge and convert characters to digitals """ Function to judge and convert characters to digitals Loading Loading @@ -381,7 +385,7 @@ 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':'SCIE', 'BIAS':'BIAS', 'DARK':'DARK', 'FLAT':'FLAT', 'CRS':'cosmic_ray', 'CRD':'cosmic_ray','CALS':'CALS','CALF':'CALF'} file_type = {'SCI':'SCIE', 'BIAS':'BIAS', 'DARK':'DARK', 'FLAT':'FLAT', 'CRS':'CRS', 'CRD':'CRD','CALS':'CALS','CALF':'CALF'} h_prim['FILETYPE'] = file_type[im_type] h_prim['FILETYPE'] = file_type[im_type] co = coord.SkyCoord(ra, dec, unit='deg') co = coord.SkyCoord(ra, dec, unit='deg') Loading Loading @@ -417,7 +421,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec file_end_time = end_time_str[0:4] + end_time_str[5:7]+end_time_str[8:10] + end_time_str[11:13] + end_time_str[14:16] + end_time_str[17:19] file_end_time = end_time_str[0:4] + end_time_str[5:7]+end_time_str[8:10] + end_time_str[11:13] + end_time_str[14:16] + end_time_str[17:19] # h_prim['FILENAME'] = 'CSST_MSC_MS_' + im_type + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + CCDID[ # h_prim['FILENAME'] = 'CSST_MSC_MS_' + im_type + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + CCDID[ # k - 1].rjust(2, '0') + '_L0_V01' # k - 1].rjust(2, '0') + '_L0_V01' h_prim['FILENAME'] = 'CSST_MSC_MS_' + im_type + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + chip_name + '_L0_V01' h_prim['FILENAME'] = 'CSST_MSC_MS_' + file_type[im_type] + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + chip_name + '_L0_V01' h_prim['POSI0_X'] = sat_pos[0] h_prim['POSI0_X'] = sat_pos[0] Loading @@ -433,12 +437,15 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec # Get version of CSSTSim Package # Get version of CSSTSim Package from pkg_resources import get_distribution from pkg_resources import get_distribution # h_prim['SIM_VER'] = (get_distribution("CSSTSim").version, "Version of CSST MSC simulation software") # h_prim['SIM_VER'] = (get_distribution("CSSTSim").version, "Version of CSST MSC simulation software") h_prim['FITSCREA'] = get_distribution("CSSTSim").version currentDateAndTime = datetime.now() compute_name = platform.node() h_prim['FITSCREA'] = get_distribution("CSSTSim").version +'_' + currentDateAndTime.strftime("%Y%m%d") + '_' +compute_name h_prim['EPOCH'] = round((Time(h_prim['EXPSTART'], format='mjd', scale='tcb')).jyear, 1) return h_prim return h_prim def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, pa = -23.433, gain = 1.0, readout = 5.0, dark = 0.02, saturation=90000, pixel_scale = 0.074, pixel_size=1e-2, def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, pa = -23.433, gain = 1.0, readout = 5.0, dark = 0.02, saturation=90000, pixel_scale = 0.074, pixel_size=1e-2, extName='SCI', row_num = None, col_num = None, xcen=None, ycen=None): extName='SCI', row_num = None, col_num = None, xcen=None, ycen=None, timestamp = 1621915200,exptime = 150., readoutTime = 40.): e_header_fn = os.path.split(os.path.realpath(__file__))[0] + '/extension_header.header' e_header_fn = os.path.split(os.path.realpath(__file__))[0] + '/extension_header.header' f = open(os.path.split(os.path.realpath(__file__))[0] + '/filter.lst') f = open(os.path.split(os.path.realpath(__file__))[0] + '/filter.lst') Loading @@ -460,47 +467,60 @@ def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, p # h_ext['CCDCHIP'] = CCDID[k - 1].rjust(2, '0') # h_ext['CCDCHIP'] = CCDID[k - 1].rjust(2, '0') # h_ext['CCDLABEL'] = filters[k-1] + '-' + filterID[k-1] # h_ext['CCDLABEL'] = filters[k-1] + '-' + filterID[k-1] # h_ext['FILTER'] = filters[k-1] # h_ext['FILTER'] = filters[k-1] h_ext['CCDCHIP'] = chip.chip_name h_ext['CHIPID'] = str(chip.chipID).rjust(2, '0') h_ext['CCDLABEL'] = chip.filter_type + '-' + str(chip.chipID).rjust(2, '0') h_ext['CHIPLAB'] = chip.chip_name h_ext['FILTER'] = chip.filter_type h_ext['FILTER'] = chip.filter_type h_ext['NAXIS1'] = xlen h_ext['NAXIS1'] = xlen h_ext['NAXIS2'] = ylen h_ext['NAXIS2'] = ylen h_ext['EXTNAME'] = extName h_ext['EXTNAME'] = extName h_ext['GAIN1'] = gain h_ext['GAIN01'] = chip.gain_channel[0] h_ext['GAIN2'] = gain h_ext['GAIN02'] = chip.gain_channel[1] h_ext['GAIN3'] = gain h_ext['GAIN03'] = chip.gain_channel[2] h_ext['GAIN4'] = gain h_ext['GAIN04'] = chip.gain_channel[3] h_ext['GAIN5'] = gain h_ext['GAIN05'] = chip.gain_channel[4] h_ext['GAIN6'] = gain h_ext['GAIN06'] = chip.gain_channel[5] h_ext['GAIN7'] = gain h_ext['GAIN07'] = chip.gain_channel[6] h_ext['GAIN8'] = gain h_ext['GAIN08'] = chip.gain_channel[7] h_ext['GAIN9'] = gain h_ext['GAIN09'] = chip.gain_channel[8] h_ext['GAIN10'] = gain h_ext['GAIN10'] = chip.gain_channel[9] h_ext['GAIN11'] = gain h_ext['GAIN11'] = chip.gain_channel[10] h_ext['GAIN12'] = gain h_ext['GAIN12'] = chip.gain_channel[11] h_ext['GAIN13'] = gain h_ext['GAIN13'] = chip.gain_channel[12] h_ext['GAIN14'] = gain h_ext['GAIN14'] = chip.gain_channel[13] h_ext['GAIN15'] = gain h_ext['GAIN15'] = chip.gain_channel[14] h_ext['GAIN16'] = gain h_ext['GAIN16'] = chip.gain_channel[15] h_ext['RDNOIS1'] = readout h_ext['RON01'] = readout h_ext['RDNOIS2'] = readout h_ext['RON02'] = readout h_ext['RDNOIS3'] = readout h_ext['RON03'] = readout h_ext['RDNOIS4'] = readout h_ext['RON04'] = readout h_ext['RDNOIS5'] = readout h_ext['RON05'] = readout h_ext['RDNOIS6'] = readout h_ext['RON06'] = readout h_ext['RDNOIS7'] = readout h_ext['RON07'] = readout h_ext['RDNOIS8'] = readout h_ext['RON08'] = readout h_ext['RDNOIS9'] = readout h_ext['RON09'] = readout h_ext['RDNOIS10'] = readout h_ext['RON10'] = readout h_ext['RDNOIS11'] = readout h_ext['RON11'] = readout h_ext['RDNOIS12'] = readout h_ext['RON12'] = readout h_ext['RDNOIS13'] = readout h_ext['RON13'] = readout h_ext['RDNOIS14'] = readout h_ext['RON14'] = readout h_ext['RDNOIS15'] = readout h_ext['RON15'] = readout h_ext['RDNOIS16'] = readout h_ext['RON16'] = readout h_ext['PIXSCAL1'] = pixel_scale h_ext['PIXSCAL1'] = pixel_scale h_ext['PIXSCAL2'] = pixel_scale h_ext['PIXSCAL2'] = pixel_scale h_ext['EXPTIME'] = exptime h_ext['DARKTIME'] = exptime + 2 datetime_obs = datetime.utcfromtimestamp(timestamp) tstart = Time(datetime_obs) tstart_read = Time(tstart.mjd + exptime / 86400., format="mjd") tend_read = Time(tstart.mjd + (exptime + readoutTime) / 86400., format="mjd") t_s1 = str(tstart_read.datetime).split() h_ext['READT0'] = t_s1[0]+'T'+t_s1[1] t_s2 = str(tend_read.datetime).split() h_ext['READT1'] = t_s2[0] + 'T' + t_s2[1] # h_ext['POS_ANG'] = pa # h_ext['POS_ANG'] = pa header_wcs = WCS_def(xlen=xlen, ylen=ylen, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=ra, dec_ref=dec, pa=pa, pixel_scale=pixel_scale, pixel_size=pixel_size, header_wcs = WCS_def(xlen=xlen, ylen=ylen, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=ra, dec_ref=dec, pa=pa, pixel_scale=pixel_scale, pixel_size=pixel_size, Loading @@ -514,8 +534,8 @@ def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, p h_ext['CD1_2'] = header_wcs['CD1_2'] h_ext['CD1_2'] = header_wcs['CD1_2'] h_ext['CD2_1'] = header_wcs['CD2_1'] h_ext['CD2_1'] = header_wcs['CD2_1'] h_ext['CD2_2'] = header_wcs['CD2_2'] h_ext['CD2_2'] = header_wcs['CD2_2'] h_ext['EQUINOX'] = header_wcs['EQUINOX'] # h_ext['EQUINOX'] = header_wcs['EQUINOX'] h_ext['WCSDIM'] = header_wcs['WCSDIM'] # h_ext['WCSDIM'] = header_wcs['WCSDIM'] h_ext['CTYPE1'] = header_wcs['CTYPE1'] h_ext['CTYPE1'] = header_wcs['CTYPE1'] h_ext['CTYPE2'] = header_wcs['CTYPE2'] h_ext['CTYPE2'] = header_wcs['CTYPE2'] Loading Loading
ObservationSim/Config/Header/ImageHeader.py +60 −40 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,10 @@ from astropy.wcs.utils import fit_wcs_from_points from astropy.time import Time from astropy.time import Time from astropy import wcs from astropy import wcs from datetime import datetime # import socket import platform def chara2digit(char): def chara2digit(char): """ Function to judge and convert characters to digitals """ Function to judge and convert characters to digitals Loading Loading @@ -381,7 +385,7 @@ 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':'SCIE', 'BIAS':'BIAS', 'DARK':'DARK', 'FLAT':'FLAT', 'CRS':'cosmic_ray', 'CRD':'cosmic_ray','CALS':'CALS','CALF':'CALF'} file_type = {'SCI':'SCIE', 'BIAS':'BIAS', 'DARK':'DARK', 'FLAT':'FLAT', 'CRS':'CRS', 'CRD':'CRD','CALS':'CALS','CALF':'CALF'} h_prim['FILETYPE'] = file_type[im_type] h_prim['FILETYPE'] = file_type[im_type] co = coord.SkyCoord(ra, dec, unit='deg') co = coord.SkyCoord(ra, dec, unit='deg') Loading Loading @@ -417,7 +421,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec file_end_time = end_time_str[0:4] + end_time_str[5:7]+end_time_str[8:10] + end_time_str[11:13] + end_time_str[14:16] + end_time_str[17:19] file_end_time = end_time_str[0:4] + end_time_str[5:7]+end_time_str[8:10] + end_time_str[11:13] + end_time_str[14:16] + end_time_str[17:19] # h_prim['FILENAME'] = 'CSST_MSC_MS_' + im_type + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + CCDID[ # h_prim['FILENAME'] = 'CSST_MSC_MS_' + im_type + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + CCDID[ # k - 1].rjust(2, '0') + '_L0_V01' # k - 1].rjust(2, '0') + '_L0_V01' h_prim['FILENAME'] = 'CSST_MSC_MS_' + im_type + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + chip_name + '_L0_V01' h_prim['FILENAME'] = 'CSST_MSC_MS_' + file_type[im_type] + '_' + file_start_time + '_' + file_end_time + '_' + OBS_id + '_' + chip_name + '_L0_V01' h_prim['POSI0_X'] = sat_pos[0] h_prim['POSI0_X'] = sat_pos[0] Loading @@ -433,12 +437,15 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec # Get version of CSSTSim Package # Get version of CSSTSim Package from pkg_resources import get_distribution from pkg_resources import get_distribution # h_prim['SIM_VER'] = (get_distribution("CSSTSim").version, "Version of CSST MSC simulation software") # h_prim['SIM_VER'] = (get_distribution("CSSTSim").version, "Version of CSST MSC simulation software") h_prim['FITSCREA'] = get_distribution("CSSTSim").version currentDateAndTime = datetime.now() compute_name = platform.node() h_prim['FITSCREA'] = get_distribution("CSSTSim").version +'_' + currentDateAndTime.strftime("%Y%m%d") + '_' +compute_name h_prim['EPOCH'] = round((Time(h_prim['EXPSTART'], format='mjd', scale='tcb')).jyear, 1) return h_prim return h_prim def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, pa = -23.433, gain = 1.0, readout = 5.0, dark = 0.02, saturation=90000, pixel_scale = 0.074, pixel_size=1e-2, def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, pa = -23.433, gain = 1.0, readout = 5.0, dark = 0.02, saturation=90000, pixel_scale = 0.074, pixel_size=1e-2, extName='SCI', row_num = None, col_num = None, xcen=None, ycen=None): extName='SCI', row_num = None, col_num = None, xcen=None, ycen=None, timestamp = 1621915200,exptime = 150., readoutTime = 40.): e_header_fn = os.path.split(os.path.realpath(__file__))[0] + '/extension_header.header' e_header_fn = os.path.split(os.path.realpath(__file__))[0] + '/extension_header.header' f = open(os.path.split(os.path.realpath(__file__))[0] + '/filter.lst') f = open(os.path.split(os.path.realpath(__file__))[0] + '/filter.lst') Loading @@ -460,47 +467,60 @@ def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, p # h_ext['CCDCHIP'] = CCDID[k - 1].rjust(2, '0') # h_ext['CCDCHIP'] = CCDID[k - 1].rjust(2, '0') # h_ext['CCDLABEL'] = filters[k-1] + '-' + filterID[k-1] # h_ext['CCDLABEL'] = filters[k-1] + '-' + filterID[k-1] # h_ext['FILTER'] = filters[k-1] # h_ext['FILTER'] = filters[k-1] h_ext['CCDCHIP'] = chip.chip_name h_ext['CHIPID'] = str(chip.chipID).rjust(2, '0') h_ext['CCDLABEL'] = chip.filter_type + '-' + str(chip.chipID).rjust(2, '0') h_ext['CHIPLAB'] = chip.chip_name h_ext['FILTER'] = chip.filter_type h_ext['FILTER'] = chip.filter_type h_ext['NAXIS1'] = xlen h_ext['NAXIS1'] = xlen h_ext['NAXIS2'] = ylen h_ext['NAXIS2'] = ylen h_ext['EXTNAME'] = extName h_ext['EXTNAME'] = extName h_ext['GAIN1'] = gain h_ext['GAIN01'] = chip.gain_channel[0] h_ext['GAIN2'] = gain h_ext['GAIN02'] = chip.gain_channel[1] h_ext['GAIN3'] = gain h_ext['GAIN03'] = chip.gain_channel[2] h_ext['GAIN4'] = gain h_ext['GAIN04'] = chip.gain_channel[3] h_ext['GAIN5'] = gain h_ext['GAIN05'] = chip.gain_channel[4] h_ext['GAIN6'] = gain h_ext['GAIN06'] = chip.gain_channel[5] h_ext['GAIN7'] = gain h_ext['GAIN07'] = chip.gain_channel[6] h_ext['GAIN8'] = gain h_ext['GAIN08'] = chip.gain_channel[7] h_ext['GAIN9'] = gain h_ext['GAIN09'] = chip.gain_channel[8] h_ext['GAIN10'] = gain h_ext['GAIN10'] = chip.gain_channel[9] h_ext['GAIN11'] = gain h_ext['GAIN11'] = chip.gain_channel[10] h_ext['GAIN12'] = gain h_ext['GAIN12'] = chip.gain_channel[11] h_ext['GAIN13'] = gain h_ext['GAIN13'] = chip.gain_channel[12] h_ext['GAIN14'] = gain h_ext['GAIN14'] = chip.gain_channel[13] h_ext['GAIN15'] = gain h_ext['GAIN15'] = chip.gain_channel[14] h_ext['GAIN16'] = gain h_ext['GAIN16'] = chip.gain_channel[15] h_ext['RDNOIS1'] = readout h_ext['RON01'] = readout h_ext['RDNOIS2'] = readout h_ext['RON02'] = readout h_ext['RDNOIS3'] = readout h_ext['RON03'] = readout h_ext['RDNOIS4'] = readout h_ext['RON04'] = readout h_ext['RDNOIS5'] = readout h_ext['RON05'] = readout h_ext['RDNOIS6'] = readout h_ext['RON06'] = readout h_ext['RDNOIS7'] = readout h_ext['RON07'] = readout h_ext['RDNOIS8'] = readout h_ext['RON08'] = readout h_ext['RDNOIS9'] = readout h_ext['RON09'] = readout h_ext['RDNOIS10'] = readout h_ext['RON10'] = readout h_ext['RDNOIS11'] = readout h_ext['RON11'] = readout h_ext['RDNOIS12'] = readout h_ext['RON12'] = readout h_ext['RDNOIS13'] = readout h_ext['RON13'] = readout h_ext['RDNOIS14'] = readout h_ext['RON14'] = readout h_ext['RDNOIS15'] = readout h_ext['RON15'] = readout h_ext['RDNOIS16'] = readout h_ext['RON16'] = readout h_ext['PIXSCAL1'] = pixel_scale h_ext['PIXSCAL1'] = pixel_scale h_ext['PIXSCAL2'] = pixel_scale h_ext['PIXSCAL2'] = pixel_scale h_ext['EXPTIME'] = exptime h_ext['DARKTIME'] = exptime + 2 datetime_obs = datetime.utcfromtimestamp(timestamp) tstart = Time(datetime_obs) tstart_read = Time(tstart.mjd + exptime / 86400., format="mjd") tend_read = Time(tstart.mjd + (exptime + readoutTime) / 86400., format="mjd") t_s1 = str(tstart_read.datetime).split() h_ext['READT0'] = t_s1[0]+'T'+t_s1[1] t_s2 = str(tend_read.datetime).split() h_ext['READT1'] = t_s2[0] + 'T' + t_s2[1] # h_ext['POS_ANG'] = pa # h_ext['POS_ANG'] = pa header_wcs = WCS_def(xlen=xlen, ylen=ylen, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=ra, dec_ref=dec, pa=pa, pixel_scale=pixel_scale, pixel_size=pixel_size, header_wcs = WCS_def(xlen=xlen, ylen=ylen, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=ra, dec_ref=dec, pa=pa, pixel_scale=pixel_scale, pixel_size=pixel_size, Loading @@ -514,8 +534,8 @@ def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, p h_ext['CD1_2'] = header_wcs['CD1_2'] h_ext['CD1_2'] = header_wcs['CD1_2'] h_ext['CD2_1'] = header_wcs['CD2_1'] h_ext['CD2_1'] = header_wcs['CD2_1'] h_ext['CD2_2'] = header_wcs['CD2_2'] h_ext['CD2_2'] = header_wcs['CD2_2'] h_ext['EQUINOX'] = header_wcs['EQUINOX'] # h_ext['EQUINOX'] = header_wcs['EQUINOX'] h_ext['WCSDIM'] = header_wcs['WCSDIM'] # h_ext['WCSDIM'] = header_wcs['WCSDIM'] h_ext['CTYPE1'] = header_wcs['CTYPE1'] h_ext['CTYPE1'] = header_wcs['CTYPE1'] h_ext['CTYPE2'] = header_wcs['CTYPE2'] h_ext['CTYPE2'] = header_wcs['CTYPE2'] Loading