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
Liu Dezi
csst_msc_sim
Commits
7ef97412
Commit
7ef97412
authored
Mar 19, 2024
by
Zhang Xin
Browse files
add calibration run step
parent
910e6afd
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
ObservationSim/Config/Header/csst_msc_l0_ms.fits
View file @
7ef97412
This diff is collapsed.
Click to expand it.
ObservationSim/SimSteps.py
View file @
7ef97412
...
...
@@ -16,6 +16,9 @@ from ObservationSim.Instrument.Chip import ChipUtils as chip_utils
from
ObservationSim.Instrument.Chip
import
Effects
from
ObservationSim.Instrument.Chip.libCTI.CTI_modeling
import
CTI_sim
from
ObservationSim.MockObject
import
FlatLED
from
ObservationSim.Instrument.FilterParam
import
FilterParam
class
SimSteps
:
def
__init__
(
self
,
overall_config
,
chip_output
,
all_filters
):
self
.
overall_config
=
overall_config
...
...
@@ -60,6 +63,51 @@ class SimSteps:
readoutTime
=
chip
.
readout_time
)
return
self
.
h_prim
,
self
.
h_ext
def
add_sky_flat_calibration
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
if
not
hasattr
(
self
,
'h_ext'
):
_
,
_
=
self
.
prepare_headers
(
chip
=
chip
,
pointing
=
pointing
)
chip_wcs
=
galsim
.
FitsWCS
(
header
=
self
.
h_ext
)
expTime
=
obs_param
[
"exptime"
]
skyback_level
=
obs_param
[
"flat_level"
]
filter_param
=
FilterParam
()
sky_level_filt
=
obs_param
[
"flat_level_filt"
]
norm_scaler
=
skyback_level
/
expTime
/
filter_param
.
param
[
sky_level_filt
][
5
]
flat_normal
=
np
.
ones_like
(
chip
.
img
.
array
)
if
obs_param
[
"flat_fielding"
]
==
True
:
flat_normal
=
flat_normal
*
chip
.
flat_img
.
array
/
np
.
mean
(
chip
.
flat_img
.
array
)
if
obs_param
[
"shutter_effect"
]
==
True
:
flat_normal
=
flat_normal
*
chip
.
shutter_img
flat_normal
=
np
.
array
(
flat_normal
,
dtype
=
'float32'
)
if
chip
.
survey_type
==
"photometric"
:
sky_map
=
flat_normal
*
np
.
ones_like
(
chip
.
img
.
array
)
*
norm_scaler
*
filter_param
.
param
[
chip
.
filter_type
][
5
]
/
tel
.
pupil_area
*
expTime
elif
chip
.
survey_type
==
"spectroscopic"
:
# flat_normal = np.ones_like(chip.img.array)
if
obs_param
[
"flat_fielding"
]
==
True
:
flat_normal
=
flat_normal
*
chip
.
flat_img
.
array
/
np
.
mean
(
chip
.
flat_img
.
array
)
if
obs_param
[
"shutter_effect"
]
==
True
:
flat_normal
=
flat_normal
*
chip
.
shutter_img
flat_normal
=
np
.
array
(
flat_normal
,
dtype
=
'float32'
)
sky_map
=
calculateSkyMap_split_g
(
skyMap
=
flat_normal
,
blueLimit
=
filt
.
blue_limit
,
redLimit
=
filt
.
red_limit
,
conf
=
chip
.
sls_conf
,
pixelSize
=
chip
.
pix_scale
,
isAlongY
=
0
,
flat_cube
=
chip
.
flat_cube
)
sky_map
=
sky_map
*
norm_scaler
*
expTime
chip
.
img
+=
sky_map
return
chip
,
filt
,
tel
,
pointing
def
add_sky_background
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
flat_normal
=
np
.
ones_like
(
chip
.
img
.
array
)
if
obs_param
[
"flat_fielding"
]
==
True
:
...
...
@@ -93,12 +141,29 @@ class SimSteps:
isAlongY
=
0
,
flat_cube
=
chip
.
flat_cube
,
zoldial_spec
=
filt
.
zodical_spec
)
sky_map
=
sky_map
+
filt
.
sky_background
sky_map
=
(
sky_map
+
filt
.
sky_background
)
*
obs_param
[
"exptime"
]
# sky_map = sky_map * tel.pupil_area * obs_param["exptime"]
chip
.
img
+=
sky_map
return
chip
,
filt
,
tel
,
pointing
def
add_LED_Flat
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
if
not
hasattr
(
self
,
'h_ext'
):
_
,
_
=
self
.
prepare_headers
(
chip
=
chip
,
pointing
=
pointing
)
chip_wcs
=
galsim
.
FitsWCS
(
header
=
self
.
h_ext
)
pf_map
=
np
.
zeros_like
(
chip
.
img
.
array
)
if
obs_param
[
"LED_TYPE"
]
is
not
None
:
if
len
(
obs_param
[
"LED_TYPE"
])
!=
0
:
print
(
"LED OPEN--------"
)
led_obj
=
FlatLED
(
chip
,
filt
)
led_flat
=
led_obj
.
drawObj_LEDFlat
(
led_type_list
=
obs_param
[
"LED_TYPE"
],
exp_t_list
=
obs_param
[
"LED_TIME"
])
pf_map
=
led_flat
chip
.
img
=
chip
.
img
+
led_flat
return
chip
,
filt
,
tel
,
pointing
def
add_objects
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
# Prepare output file(s) for this chip
...
...
@@ -416,6 +481,13 @@ class SimSteps:
return
chip
,
filt
,
tel
,
pointing
def
quantization_and_output
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
if
obs_param
[
"format_output"
]
==
True
:
self
.
chip_output
.
Log_info
(
" Apply 1*16 format"
)
chip
.
img
=
chip_utils
.
formatOutput
(
GSImage
=
chip
.
img
)
chip
.
nsecy
=
1
chip
.
nsecx
=
16
chip
.
img
.
array
[
chip
.
img
.
array
>
65535
]
=
65535
chip
.
img
.
replaceNegative
(
replace_value
=
0
)
chip
.
img
.
quantize
()
...
...
@@ -450,5 +522,7 @@ SIM_STEP_TYPES = {
"bias"
:
"add_bias"
,
"readout_noise"
:
"add_readout_noise"
,
"gain"
:
"apply_gain"
,
"quantization_and_output"
:
"quantization_and_output"
"quantization_and_output"
:
"quantization_and_output"
,
"led_calib_model"
:
"add_LED_Flat"
,
"sky_flatField"
:
"add_sky_flat_calibration"
,
}
\ No newline at end of file
config/obs_config_Calibration.yaml
0 → 100644
View file @
7ef97412
---
###############################################
#
# Configuration file for CSST simulation
# For single exposure type:
# SCI-WIDE
# CSST-Sim Group, 2024/01/08
#
###############################################
# Observation type
obs_type
:
"
DARK"
# Define list of chips
run_chips
:
[
8
]
# Define observation sequence
call_sequence
:
# Accumulate fluxes from objects
led_calib_model
:
#"LED": ['LED1','LED2','LED3','LED4','LED5','LED6','LED7','LED8','LED9','LED10','LED11','LED12','LED13','LED14'] or null
#'LED1': '275', 'LED2': '310', 'LED3': '430', 'LED4': '505', 'LED5': '545', 'LED6': '590', 'LED7': '670',
#'LED8': '760', 'LED9': '940', 'LED10': '940', 'LED11': '1050', 'LED12': '1050','LED13': '340', 'LED14': '365'
LED_TYPE
:
[
'
LED5'
]
LED_TIME
:
[
1.
]
sky_flatField
:
exptime
:
150.
# [s]
shutter_effect
:
YES
flat_fielding
:
YES
flat_level
:
20000
flat_level_filt
:
g
# Apply PRNU to accumulated photons
PRNU_effect
:
{}
# Accumulate photons caused by cosmic rays
cosmic_rays
:
{}
# Add Poission noise and dark current
poisson_and_dark
:
add_dark
:
YES
# Simulate brighter fatter effects
bright_fatter
:
{}
# Add detector defects: hot/warm pixels, bad columns
detector_defects
:
hot_pixels
:
YES
dead_pixels
:
YES
bad_columns
:
YES
# Apply response nonlinearity
nonlinearity
:
{}
# Apply CCD Saturation & Blooming
blooming
:
{}
# # Run CTE simulation
CTE_effect
:
{}
# Add prescan and overscan
prescan_overscan
:
{}
# Add bias
bias
:
bias_16channel
:
YES
# Add readout noise
readout_noise
:
{}
# Apply gain
gain
:
gain_16channel
:
YES
# Output the final image
quantization_and_output
:
format_output
:
NO
...
\ No newline at end of file
config/obs_config_SCI_WIDE_phot.yaml
View file @
7ef97412
...
...
@@ -12,7 +12,7 @@
obs_type
:
"
SCI"
# Define list of chips
run_chips
:
[
6
,
7
,
8
,
9
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
22
,
23
,
24
,
25
]
run_chips
:
[
8
]
# Define observation sequence
call_sequence
:
...
...
@@ -59,5 +59,6 @@ call_sequence:
gain
:
gain_16channel
:
YES
# Output the final image
quantization_and_output
:
{}
quantization_and_output
:
format_output
:
YES
...
\ No newline at end of file
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