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_msc_sim
Commits
741c0eb1
Commit
741c0eb1
authored
Dec 23, 2025
by
JX
😵
Browse files
Merge remote-tracking branch 'origin/develop'
parents
6b76aa65
cdf5fb1f
Pipeline
#11605
passed with stage
in 0 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
config/config_overall.yaml
View file @
741c0eb1
...
...
@@ -11,8 +11,8 @@
# can add some of the command-line arguments here as well;
# ok to pass either way or both, as long as they are consistent
work_dir
:
"
/public/home/fangyuedong/project/workplace/"
run_name
:
"
ext_on
"
data_set
:
"
csst-msc-c11-
1000sqdeg
-wide-v1"
run_name
:
"
csst-msc-c11-test-wide-v1
"
data_set
:
"
csst-msc-c11-
test
-wide-v1"
# Project cycle and run counter are used to name the outputs
project_cycle
:
11
...
...
config/obs_config_SCI.yaml
View file @
741c0eb1
...
...
@@ -9,14 +9,13 @@
###############################################
# Observation type
obs_type
:
"
SCI"
obs_type
:
null
obs_type_code
:
"
101"
obs_id
:
"
00000001"
# this setting will only be used if pointing list file is not given
# Define list of chips
# run_chips: [6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25] # Photometric chips
#run_chips: [1,2,3,4,5,10,21,26,27,28,29,30] # Spectroscopic chips
run_chips
:
[
17
,
22
]
run_chips
:
[
6
,
7
,
8
,
9
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
22
,
23
,
24
,
25
]
# Photometric chips
# run_chips: [1,2,3,4,5,10,21,26,27,28,29,30] # Spectroscopic chips
# Define observation sequence
call_sequence
:
...
...
@@ -55,11 +54,12 @@ call_sequence:
# Set it here is you want to override the default
# exptime: 150. # [s]
add_dark
:
YES
input_dark
:
YES
# Simulate brighter fatter effects
bright_fatter
:
{}
# Add detector defects: hot/warm pixels, bad columns
detector_defects
:
hot_pixels
:
YES
#
hot_pixels:
NO
dead_pixels
:
YES
bad_columns
:
YES
# Apply CCD Saturation & Blooming
...
...
observation_sim/instruments/chip/Chip.py
View file @
741c0eb1
...
...
@@ -124,6 +124,7 @@ class Chip(FocalPlane):
self
.
rotate_angle
=
0.
self
.
overscan
=
1000
self
.
badfraction
=
5e-5
self
.
chip_type
=
'default'
# Override default values
# for key in ["gain", "bias_level, dark_exptime", "flat_exptime", "readout_time", "full_well", "read_noise", "dark_noise", "overscan"]:
# if key in config["ins_effects"]:
...
...
observation_sim/instruments/chip/chip_utils.py
View file @
741c0eb1
...
...
@@ -214,44 +214,72 @@ def get_poisson(seed=0, sky_level=0.):
return
rng_poisson
,
poisson_noise
def
get_base_img
(
img
,
chip
,
read_noise
,
readout_time
,
dark_noise
,
exptime
=
150.
,
InputDark
=
Non
e
):
if
InputDark
is
None
:
def
get_base_img
(
img
,
chip
,
read_noise
,
readout_time
,
dark_noise
,
exptime
=
150.
,
InputDark
=
Fals
e
):
if
not
InputDark
:
# base_level = read_noise**2 + dark_noise*(exptime+0.5*readout_time)
# base_level = dark_noise*(exptime+0.5*readout_time)
base_level
=
dark_noise
*
(
exptime
)
base_img1
=
base_level
*
np
.
ones_like
(
img
.
array
)
else
:
base_img1
=
np
.
zeros_like
(
img
.
array
)
ny
=
int
(
chip
.
npix_y
/
2
)
nx
=
chip
.
npix_x
arr
=
np
.
arange
(
ny
).
reshape
(
ny
,
1
)
arr
=
np
.
broadcast_to
(
arr
,
(
ny
,
nx
))
base_img2
=
np
.
zeros_like
(
img
.
array
)
base_img2
[:
ny
,
:]
=
arr
base_img2
[
ny
:,
:]
=
arr
[::
-
1
,
:]
base_img2
[:,
:]
=
base_img2
[:,
:]
*
(
readout_time
/
ny
)
*
dark_noise
return
base_img1
+
base_img2
def
add_poisson
(
img
,
chip
,
exptime
=
150.
,
seed
=
0
,
sky_level
=
0.
,
poisson_noise
=
None
,
dark_noise
=
None
,
InputDark
=
None
):
ny
=
int
(
chip
.
npix_y
/
2
)
nx
=
chip
.
npix_x
arr
=
np
.
arange
(
ny
).
reshape
(
ny
,
1
)
arr
=
np
.
broadcast_to
(
arr
,
(
ny
,
nx
))
base_img2
=
np
.
zeros_like
(
img
.
array
)
base_img2
[:
ny
,
:]
=
arr
base_img2
[
ny
:,
:]
=
arr
[::
-
1
,
:]
base_img2
[:,
:]
=
base_img2
[:,
:]
*
(
readout_time
/
ny
)
*
dark_noise
else
:
# base_img1 = np.zeros_like(img.array)
histfile
=
'hist_dark_{:}.npz'
.
format
(
chip
.
chip_type
)
try
:
with
pkg_resources
.
files
(
'observation_sim.instruments.data.ccd'
).
joinpath
(
histfile
)
as
dark_histogram
:
hist_dc
=
np
.
load
(
dark_histogram
)
except
AttributeError
:
with
pkg_resources
.
path
(
'observation_sim.instruments.data.ccd'
,
histfile
)
as
dark_histogram
:
hist_dc
=
np
.
load
(
dark_histogram
)
hist
=
stats
.
rv_histogram
((
hist_dc
[
'counts'
],
hist_dc
[
'bins'
]),
density
=
True
)
xsize
=
chip
.
npix_x
ysize
=
chip
.
npix_y
seed
=
chip
.
chipID
samples
=
hist
.
rvs
(
size
=
xsize
*
ysize
,
random_state
=
seed
)
map_dc
=
np
.
reshape
(
samples
,
[
ysize
,
xsize
])
base_img1
=
map_dc
*
exptime
# base_img2
map_temp
=
np
.
zeros
((
ysize
//
2
,
2
*
xsize
))
map_temp
[:,
:
xsize
]
=
map_dc
[:
ysize
//
2
,
:]
map_temp
[:,
xsize
:]
=
map_dc
[:
ysize
//
2
-
1
:
-
1
,
:]
dt
=
readout_time
/
(
ysize
/
2.
)
A
=
map_temp
A_adjusted
=
np
.
vstack
([
np
.
zeros
((
1
,
A
.
shape
[
1
])),
A
[:
-
1
]])
cumsum_A
=
np
.
cumsum
(
A_adjusted
,
axis
=
0
)
B
=
cumsum_A
*
dt
base_img2
=
np
.
vstack
([
B
[:,
:
xsize
],
B
[::
-
1
,
xsize
:]])
del
hist_dc
del
hist
del
samples
del
map_temp
del
A
del
A_adjusted
del
cumsum_A
del
B
return
base_img1
+
base_img2
,
map_dc
def
add_poisson
(
img
,
chip
,
exptime
=
150.
,
seed
=
0
,
sky_level
=
0.
,
poisson_noise
=
None
,
dark_noise
=
None
,
InputDark
=
False
):
if
poisson_noise
is
None
:
_
,
poisson_noise
=
get_poisson
(
seed
=
seed
,
sky_level
=
sky_level
)
read_noise
=
chip
.
read_noise
if
dark_noise
is
None
:
dark_noise
=
chip
.
dark_noise
base_img
=
get_base_img
(
img
=
img
,
chip
=
chip
,
read_noise
=
read_noise
,
readout_time
=
chip
.
readout_time
,
dark_noise
=
dark_noise
,
exptime
=
exptime
,
InputDark
=
InputDark
)
base_img
,
map_dc
=
get_base_img
(
img
=
img
,
chip
=
chip
,
read_noise
=
read_noise
,
readout_time
=
chip
.
readout_time
,
dark_noise
=
dark_noise
,
exptime
=
exptime
,
InputDark
=
InputDark
)
img
+=
base_img
img
.
addNoise
(
poisson_noise
)
# img -= read_noise**2
if
InputDark
is
not
None
:
# "Instrument/data/dark/dark_1000s_example_0.fits"
hdu
=
fits
.
open
(
InputDark
)
img
+=
hdu
[
0
].
data
/
hdu
[
0
].
header
[
'exptime'
]
*
exptime
hdu
.
close
()
return
img
,
base_img
del
base_img
return
img
,
map_dc
def
add_brighter_fatter
(
img
):
...
...
observation_sim/instruments/data/ccd/chip_definition.json
View file @
741c0eb1
{
"31"
:
{
"chip_name"
:
"FGS1A-D1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -23,6 +24,7 @@
},
"32"
:
{
"chip_name"
:
"FGS1A-D2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -45,6 +47,7 @@
},
"33"
:
{
"chip_name"
:
"FGS1B-D1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -67,6 +70,7 @@
},
"34"
:
{
"chip_name"
:
"FGS1B-D2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -89,6 +93,7 @@
},
"35"
:
{
"chip_name"
:
"FGS2A-D1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -111,6 +116,7 @@
},
"36"
:
{
"chip_name"
:
"FGS2A-D2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -133,6 +139,7 @@
},
"37"
:
{
"chip_name"
:
"FGS2B-D1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -155,6 +162,7 @@
},
"38"
:
{
"chip_name"
:
"FGS2B-D2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -177,6 +185,7 @@
},
"39"
:
{
"chip_name"
:
"FGS3-D1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -199,6 +208,7 @@
},
"40"
:
{
"chip_name"
:
"FGS3-D2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -221,6 +231,7 @@
},
"41"
:
{
"chip_name"
:
"FGS4-D1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -243,6 +254,7 @@
},
"42"
:
{
"chip_name"
:
"FGS4-D2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.0075
,
"pix_scale"
:
0.0555
,
"npix_x"
:
11264
,
...
...
@@ -265,6 +277,7 @@
},
"1"
:
{
"chip_name"
:
"GI-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -288,6 +301,7 @@
},
"2"
:
{
"chip_name"
:
"GV-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -311,6 +325,7 @@
},
"3"
:
{
"chip_name"
:
"GU-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -334,6 +349,7 @@
},
"4"
:
{
"chip_name"
:
"GU-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -357,6 +373,7 @@
},
"5"
:
{
"chip_name"
:
"GV-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -380,6 +397,7 @@
},
"6"
:
{
"chip_name"
:
"y-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -403,6 +421,7 @@
},
"7"
:
{
"chip_name"
:
"i-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -426,6 +445,7 @@
},
"8"
:
{
"chip_name"
:
"g-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -449,6 +469,7 @@
},
"9"
:
{
"chip_name"
:
"r-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -472,6 +493,7 @@
},
"10"
:
{
"chip_name"
:
"GI-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -495,6 +517,7 @@
},
"11"
:
{
"chip_name"
:
"z-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -518,6 +541,7 @@
},
"12"
:
{
"chip_name"
:
"NUV-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -541,6 +565,7 @@
},
"13"
:
{
"chip_name"
:
"NUV-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -564,6 +589,7 @@
},
"14"
:
{
"chip_name"
:
"u-1"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -587,6 +613,7 @@
},
"15"
:
{
"chip_name"
:
"y-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -610,6 +637,7 @@
},
"16"
:
{
"chip_name"
:
"y-3"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -633,6 +661,7 @@
},
"17"
:
{
"chip_name"
:
"u-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -656,6 +685,7 @@
},
"18"
:
{
"chip_name"
:
"NUV-3"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -679,6 +709,7 @@
},
"19"
:
{
"chip_name"
:
"NUV-4"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -702,6 +733,7 @@
},
"20"
:
{
"chip_name"
:
"z-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -725,6 +757,7 @@
},
"21"
:
{
"chip_name"
:
"GI-3"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -748,6 +781,7 @@
},
"22"
:
{
"chip_name"
:
"r-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -771,6 +805,7 @@
},
"23"
:
{
"chip_name"
:
"g-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -794,6 +829,7 @@
},
"24"
:
{
"chip_name"
:
"i-2"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -817,6 +853,7 @@
},
"25"
:
{
"chip_name"
:
"y-4"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -840,6 +877,7 @@
},
"26"
:
{
"chip_name"
:
"GV-3"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -863,6 +901,7 @@
},
"27"
:
{
"chip_name"
:
"GU-3"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -886,6 +925,7 @@
},
"28"
:
{
"chip_name"
:
"GU-4"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -909,6 +949,7 @@
},
"29"
:
{
"chip_name"
:
"GV-4"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
@@ -932,6 +973,7 @@
},
"30"
:
{
"chip_name"
:
"GI-4"
,
"chip_type"
:
"default"
,
"pix_size"
:
0.01
,
"pix_scale"
:
0.074
,
"npix_x"
:
9216
,
...
...
observation_sim/instruments/data/ccd/hist_dark_default.npz
0 → 100644
View file @
741c0eb1
File added
observation_sim/sim_steps/add_pattern_noise.py
View file @
741c0eb1
...
...
@@ -20,11 +20,13 @@ def add_poisson_and_dark(self, chip, filt, tel, pointing, catalog, obs_param):
exptime
=
pointing
.
exp_time
if
obs_param
[
"add_dark"
]
is
True
:
if
obs_param
[
"input_dark"
]:
self
.
chip_output
.
Log_info
(
" Applying input_dark"
)
chip
.
img
,
_
=
chip_utils
.
add_poisson
(
img
=
chip
.
img
,
chip
=
chip
,
exptime
=
exptime
,
poisson_noise
=
chip
.
poisson_noise
,
InputDark
=
None
)
InputDark
=
obs_param
[
"input_dark"
]
)
else
:
chip
.
img
,
_
=
chip_utils
.
add_poisson
(
img
=
chip
.
img
,
chip
=
chip
,
...
...
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