Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-sims
csst_ifs_sim
Commits
6326829d
Commit
6326829d
authored
Apr 10, 2024
by
Yan Zhaojun
Browse files
update setup.py
parent
97ee4bb5
Pipeline
#3976
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_ifs_sim/csst_ifs_sim.py
View file @
6326829d
...
...
@@ -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:
#. Read in a configuration file, which defines for example,
detector characteristics (bias, dark and readout noise, gain,
plate scale and pixel scale, oversampling factor, exposure time etc.).
#. 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 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 wavelength and field of view.
#. 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 whether the object lands on to the detector or not and if it is
a star or an extended source (i.e. a galaxy).
* if object is extended determine the size (using a size-magnitude relation) and scale counts,
convolve with the PSF, and finally overlay onto the detector according to its position.
* if object is a star, scale counts according to the derived
scaling (first step), and finally overlay onto the detector according to its position.
* add a ghost of image of the object (scaled to the peak pixel of the object) [optional].
#. Apply calibration unit flux to mimic flat field exposures [optional].
#. Apply a multiplicative flat-field map to emulate pixel-to-pixel non-uniformity [optional].
#. Add a charge injection line (horizontal and/or vertical) [optional].
#. Add cosmic ray tracks onto the CCD with random positions but known distribution [optional].
#. Apply detector charge bleeding in column direction [optional].
#. Add constant dark current and background light from Zodiacal light [optional].
#. Include spatially uniform scattered light to the pixel grid [optional].
#. Add photon (Poisson) noise [optional]
#. Add cosmetic defects from an input file [optional].
#. Add pre- and overscan regions in the serial direction [optional].
#. Apply the CDM03 radiation damage model [optional].
#. Apply CCD273 non-linearity model to the pixel data [optional].
#. Add readout noise selected from a Gaussian distribution [optional].
#. Convert from electrons to ADUs using a given gain factor.
#. 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.
#. Read in a configuration file, which defines for example,
detector characteristics (bias, dark and readout noise, gain,
plate scale and pixel scale, oversampling factor, exposure time etc.).
#. 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 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
wavelength and field of view.
#. 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 whether the object lands on to the detector or not and if it is
a star or an extended source (i.e. a galaxy).
* if object is extended determine the size (using a size-magnitude relation)
and scale counts, convolve with the PSF, and finally overlay onto the
detector according to its position.
* if object is a star, scale counts according to the derived scaling
(first step), and finally overlay onto the detector according to its position.
#. Apply calibration unit flux to mimic flat field exposures [optional].
#. Apply a multiplicative flat-field map to emulate pixel-to-pixel non-uniformity [optional].
#. Add a charge injection line (horizontal and/or vertical) [optional].
#. Add cosmic ray tracks onto the CCD with random positions but known distribution [optional].
#. Apply detector charge bleeding in column direction [optional].
#. Add constant dark current and background light from Zodiacal light [optional].
#. Include spatially uniform scattered light to the pixel grid [optional].
#. Add photon (Poisson) noise [optional]
#. Add cosmetic defects from an input file [optional].
#. Add pre- and overscan regions in the serial direction [optional].
#. Apply the CDM03 radiation damage model [optional].
#. Apply CCD273 non-linearity model to the pixel data [optional].
#. Add readout noise selected from a Gaussian distribution [optional].
#. Convert from electrons to ADUs using a given gain factor.
#. 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.
The code has been tested, but nevertheless bugs may be lurking in corners, so
...
...
@@ -1389,14 +1391,20 @@ class IFSsimulator():
else
:
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:
# self.result_path='/data/ifspip/CCD_ima/IFS_simData_'+self.source+ss+result_day
if
home_path
==
'/home/yan'
:
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
:
os
.
mkdir
(
self
.
result_path
)
...
...
@@ -5018,18 +5026,12 @@ class IFSsimulator():
self
.
log
.
info
(
'%s = %s'
%
(
key
,
value
))
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'
):
# opts, args = processArgs()
# opts.configfile = configfile
simulate
=
dict
()
simulate
[
iLoop
]
=
IFSsimulator
(
configfile
)
...
...
@@ -5040,12 +5042,6 @@ def runIFSsim(sourcein, configfile, iLoop, applyhole='no'):
dir_path
=
os
.
path
.
join
(
os
.
environ
[
'UNIT_TEST_DATA_ROOT'
],
'ifs_sim/'
)
simulate
[
iLoop
].
information
[
'dir_path'
]
=
dir_path
###############
##############
simulate
[
iLoop
].
simulate
(
sourcein
,
iLoop
)
return
1
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment