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
cdf5fb1f
You need to sign in or sign up before continuing.
Commit
cdf5fb1f
authored
Dec 23, 2025
by
Wei Chengliang
Browse files
pep8 coding style
parent
0efad3cf
Pipeline
#11604
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
observation_sim/instruments/chip/chip_utils.py
View file @
cdf5fb1f
...
...
@@ -239,10 +239,10 @@ def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150.,
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
xsize
=
chip
.
npix_x
ysize
=
chip
.
npix_y
seed
=
chip
.
chipID
samples
=
hist
.
rvs
(
size
=
xsize
*
ysize
,
random_state
=
seed
)
samples
=
hist
.
rvs
(
size
=
xsize
*
ysize
,
random_state
=
seed
)
map_dc
=
np
.
reshape
(
samples
,
[
ysize
,
xsize
])
base_img1
=
map_dc
*
exptime
...
...
@@ -251,10 +251,10 @@ def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150.,
map_temp
[:,
:
xsize
]
=
map_dc
[:
ysize
//
2
,
:]
map_temp
[:,
xsize
:]
=
map_dc
[:
ysize
//
2
-
1
:
-
1
,
:]
dt
=
readout_time
/
(
ysize
/
2.
)
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
)
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
...
...
@@ -274,8 +274,7 @@ def add_poisson(img, chip, exptime=150., seed=0, sky_level=0., poisson_noise=Non
read_noise
=
chip
.
read_noise
if
dark_noise
is
None
:
dark_noise
=
chip
.
dark_noise
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
)
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
...
...
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