Commit 6326829d authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update setup.py

parent 97ee4bb5
Pipeline #3976 passed with stage
in 0 seconds
...@@ -14,46 +14,48 @@ This file contains an image simulator for the CSST IFS. ...@@ -14,46 +14,48 @@ This file contains an image simulator for the CSST IFS.
The approximate sequence of events in the simulator is as follows: The approximate sequence of events in the simulator is as follows:
#. Read in a configuration file, which defines for example, #. Read in a configuration file, which defines for example,
detector characteristics (bias, dark and readout noise, gain, detector characteristics (bias, dark and readout noise, gain,
plate scale and pixel scale, oversampling factor, exposure time etc.). plate scale and pixel scale, oversampling factor, exposure time etc.).
#. Read in another file containing charge trap definitions (for CTI modelling). #. Read in another file containing charge trap definitions (for CTI modelling).
#. Read in a file defining the cosmic rays (trail lengths and cumulative distributions). #. Read in a file defining the cosmic rays (trail lengths and
#. Read in CCD offset information, displace the image, and modify cumulative distributions).
the output file name to contain the CCD and quadrant information #. Read in CCD offset information, displace the image, and modify
the output file name to contain the CCD and quadrant information
#. Load the wavefront aberration data used to calculate PSF with defined
#. Load the wavefront aberration data used to calculate PSF with defined wavelength and field of view. wavelength and field of view.
#. Loop over the number of exposures to co-add and for each object in the object catalog: #. Loop over the number of exposures to co-add and for each object in the
object catalog:
* determine the number of electrons an object should have by scaling the object's magnitude
with the given zeropoint and exposure time. * determine the number of electrons an object should have by scaling the
* determine whether the object lands on to the detector or not and if it is object's magnitude
a star or an extended source (i.e. a galaxy). with the given zeropoint and exposure time.
* if object is extended determine the size (using a size-magnitude relation) and scale counts, * determine whether the object lands on to the detector or not and if it is
convolve with the PSF, and finally overlay onto the detector according to its position. a star or an extended source (i.e. a galaxy).
* if object is a star, scale counts according to the derived * if object is extended determine the size (using a size-magnitude relation)
scaling (first step), and finally overlay onto the detector according to its position. and scale counts, convolve with the PSF, and finally overlay onto the
* add a ghost of image of the object (scaled to the peak pixel of the object) [optional]. detector according to its position.
* if object is a star, scale counts according to the derived scaling
#. Apply calibration unit flux to mimic flat field exposures [optional]. (first step), and finally overlay onto the detector according to its position.
#. Apply a multiplicative flat-field map to emulate pixel-to-pixel non-uniformity [optional].
#. Add a charge injection line (horizontal and/or vertical) [optional]. #. Apply calibration unit flux to mimic flat field exposures [optional].
#. Add cosmic ray tracks onto the CCD with random positions but known distribution [optional]. #. Apply a multiplicative flat-field map to emulate pixel-to-pixel non-uniformity [optional].
#. Apply detector charge bleeding in column direction [optional]. #. Add a charge injection line (horizontal and/or vertical) [optional].
#. Add constant dark current and background light from Zodiacal light [optional]. #. Add cosmic ray tracks onto the CCD with random positions but known distribution [optional].
#. Include spatially uniform scattered light to the pixel grid [optional]. #. Apply detector charge bleeding in column direction [optional].
#. Add photon (Poisson) noise [optional] #. Add constant dark current and background light from Zodiacal light [optional].
#. Add cosmetic defects from an input file [optional]. #. Include spatially uniform scattered light to the pixel grid [optional].
#. Add pre- and overscan regions in the serial direction [optional]. #. Add photon (Poisson) noise [optional]
#. Apply the CDM03 radiation damage model [optional]. #. Add cosmetic defects from an input file [optional].
#. Apply CCD273 non-linearity model to the pixel data [optional]. #. Add pre- and overscan regions in the serial direction [optional].
#. Add readout noise selected from a Gaussian distribution [optional]. #. Apply the CDM03 radiation damage model [optional].
#. Convert from electrons to ADUs using a given gain factor. #. Apply CCD273 non-linearity model to the pixel data [optional].
#. Add a given bias level and discretise the counts (the output is going to be in 16bit unsigned integers). #. Add readout noise selected from a Gaussian distribution [optional].
#. Finally the simulated image is converted to a FITS file, a WCS is assigned #. Convert from electrons to ADUs using a given gain factor.
and the output is saved to the current working directory. #. Add a given bias level and discretise the counts (the output is going to be in 16bit unsigned integers).
#. Finally the simulated image is converted to a FITS file, a WCS is assigned
and the output is saved to the current working directory.
.. Warning:: The code is still work in progress and new features are being added. .. Warning:: The code is still work in progress and new features are being added.
The code has been tested, but nevertheless bugs may be lurking in corners, so The code has been tested, but nevertheless bugs may be lurking in corners, so
...@@ -1389,14 +1391,20 @@ class IFSsimulator(): ...@@ -1389,14 +1391,20 @@ class IFSsimulator():
else: else:
ss = '_' ss = '_'
# if currentpath =='/home/yan/IFS': if self.information['dir_path']=='/nfsdata/share/simulation-unittest/ifs_sim/':
self.result_path = self.information['dir_path']+'ifs_sim_result/'+self.source+ss+result_day
else:
# self.result_path='../IFS_simData_'+self.source+ss+result_day home_path = os.environ['HOME']
# else: if home_path == '/home/yan':
# self.result_path='/data/ifspip/CCD_ima/IFS_simData_'+self.source+ss+result_day
self.result_path = '../IFS_simData_'+self.source+ss+result_day
else:
self.result_path = '/data/ifspip/CCD_ima/IFS_simData_'+self.source+ss+result_day
self.result_path = self.information['dir_path']+'ifs_sim_result/'+self.source+ss+result_day
if os.path.isdir(self.result_path) == False: if os.path.isdir(self.result_path) == False:
os.mkdir(self.result_path) os.mkdir(self.result_path)
...@@ -5018,18 +5026,12 @@ class IFSsimulator(): ...@@ -5018,18 +5026,12 @@ class IFSsimulator():
self.log.info('%s = %s' % (key, value)) self.log.info('%s = %s' % (key, value))
self.log.info('Finished the ith_Exposure = %i' % (simnumber)) self.log.info('Finished the ith_Exposure = %i' % (simnumber))
#print('The iLoop= % d simlaiton finished. ' %simnumber) # print('The iLoop= % d simlaiton finished. ' %simnumber)
##############################################################################################
##############################################################################################
############################################################################
############################################################################
def runIFSsim(sourcein, configfile, iLoop, applyhole='no'): def runIFSsim(sourcein, configfile, iLoop, applyhole='no'):
# opts, args = processArgs()
# opts.configfile = configfile
simulate = dict() simulate = dict()
simulate[iLoop] = IFSsimulator(configfile) simulate[iLoop] = IFSsimulator(configfile)
...@@ -5040,12 +5042,6 @@ def runIFSsim(sourcein, configfile, iLoop, applyhole='no'): ...@@ -5040,12 +5042,6 @@ def runIFSsim(sourcein, configfile, iLoop, applyhole='no'):
dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/') dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
simulate[iLoop].information['dir_path'] = dir_path simulate[iLoop].information['dir_path'] = dir_path
###############
##############
simulate[iLoop].simulate(sourcein, iLoop) simulate[iLoop].simulate(sourcein, iLoop)
return 1 return 1
......
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