Commit 633fbbab authored by Fang Yuedong's avatar Fang Yuedong
Browse files

first test

parent 8d77fcd3
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -342,7 +342,7 @@ def WCS_def(xlen = 9216, ylen = 9232, gapy = 898.0, gapx1 = 534, gapx2 = 1309, r


#TODO project_cycle is temporary, is not in header defined, delete in future
def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec = -40, pixel_scale = 0.074, date='200930', time_obs='120000', im_type = 'MS', exptime=150., sat_pos = [0.,0.,0.], sat_vel = [0., 0., 0.], project_cycle=6, run_counter=0, chip_name="01"):
def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec = -40, pixel_scale = 0.074, date='200930', time_obs='120000', im_type = 'SCIE', exptime=150., sat_pos = [0.,0.,0.], sat_vel = [0., 0., 0.], project_cycle=6, run_counter=0, chip_name="01"):

    # array_size1, array_size2, flux, sigma = int(argv[1]), int(argv[2]), 1000.0, 5.0

@@ -391,7 +391,8 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec
    # # Define file types
    # 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'] = get_file_type(img_type=im_type)
    # h_prim['FILETYPE'] = get_file_type(img_type=im_type)
    h_prim['FILETYPE'] = im_type

    co = coord.SkyCoord(ra, dec, unit='deg')

@@ -450,7 +451,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec
    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, 
                            extName='SCI', row_num = None, col_num = None, xcen=None, ycen=None, timestamp = 1621915200,exptime = 150., readoutTime = 40.):
                            extName='SCIE', 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'
    f = open(os.path.split(os.path.realpath(__file__))[0] + '/filter.lst')
+12 −2
Original line number Diff line number Diff line
import numpy as np
import galsim
import yaml
from astropy.time import Time

import ObservationSim.Instrument._util as _util
@@ -42,13 +43,13 @@ class Pointing(object):
                    return max(150., self.exp_time) # [TODO] for FGS


    def read_pointing_columns(self, columns, id=0, t=1621915200, pointing_type='SCI'):
    def read_pointing_columns(self, columns, id=0, t=1621915200, pointing_type='SCIE'):
        self.id = id
        col_len = len(columns)
        self.ra = float(columns[0])
        self.dec = float(columns[1])
        self.img_pa = float(columns[4]) * galsim.degrees
        self.pointing_type = pointing_type
        # self.pointing_type = pointing_type
        if col_len > 5:
            jdt = np.double(columns[5])
            t_temp = Time(jdt, format='jd')
@@ -68,5 +69,14 @@ class Pointing(object):
            # [TODO] Can also define other survey types
            if is_deep != -1.0:
                self.survey_field_type = "DEEP"
            
            # Load the configuration file for this particular pointing
            self.obs_config_file = "/share/home/fangyuedong/20231211/csst-simulation/config/obs_config_SCI_WIDE_phot.yaml"
            with open(self.obs_config_file, "r") as stream:
                try:
                    self.obs_param = yaml.safe_load(stream)
                except yaml.YAMLError as exc:
                    print(exc)
            self.pointing_type = self.obs_config_file["obs_type"]
        else:
            self.timestamp = t
+2 −3
Original line number Diff line number Diff line

def get_obs_id(img_type='SCI', project_cycle=6, run_counter=0, pointing_num=0):
def get_obs_id(img_type='SCIE', project_cycle=6, run_counter=0, pointing_num=0):
    # obs_type = {'SCI': '01', 'BIAS': '03', 'DARK': '07', 'FLAT': '11', 'CRS': '98', 'CRD': '99'}
    obs_type = {'SCI': '01', 'BIAS': '03', 'DARK': '07', 'FLAT': '11', 'CRS': '98', 'CRD': '99', 'CAL': '01'}
    # obs_id = '1'+ obs_type[img_type] + str(int(project_cycle)) + str(int(run_counter)).rjust(2, '0') + str(pointing_num).rjust(5,'0')
    obs_type = {'SCIE': '01', 'BIAS': '03', 'DARK': '07', 'FLAT': '11', 'CRS': '98', 'CRD': '99', 'CAL': '01'}
    obs_id = '1'+ obs_type[img_type] + str(int(project_cycle)).rjust(2, '0') + str(int(run_counter)) + str(pointing_num).rjust(8,'0')
    return obs_id

+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ def generateHeader(chip, ra_cen, dec_cen, img_rot, im_type, pointing_ID, exptime
        pixel_size=chip.pix_size,
        xcen=chip.x_cen,
        ycen=chip.y_cen,
        extName='SCI',
        extName='SCIE',
        timestamp = timestamp,
        exptime = exptime,
        readoutTime = chip.readout_time)
+10 −3
Original line number Diff line number Diff line
@@ -2,17 +2,24 @@ import galsim
import numpy as np

class FocalPlane(object):
    def __init__(self, config=None, survey_type='Photometric', bad_chips=None):
    def __init__(self, config=None, chip_list=None, survey_type='Photometric', bad_chips=None):
        """Get the focal plane layout
        """
        self.nchips = 42
        self.ignore_chips = []

        if bad_chips == None:
            self.bad_chips = []
        else:
            self.bad_chips = bad_chips
            for chip_id in bad_chips:
                self.ignore_chips.append(chip_id)
        
        self.ignore_chips = []
        if survey_type == 'Photometric':
        if chip_list is not None:
            for i in range(42):
                if not (i+1 in chip_list):
                    self.ignore_chips.append(i+1)
        elif survey_type == 'Photometric':
            for i in range(5):
                self.ignore_chips.append(i+1)
                self.ignore_chips.append(i+26)
Loading