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
5fd170d7
Commit
5fd170d7
authored
Oct 26, 2024
by
Wei Chengliang
Browse files
update codestyle-PEP8
parent
c326c535
Pipeline
#7107
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
observation_sim/sim_steps/readout_output.py
View file @
5fd170d7
...
@@ -17,13 +17,52 @@ def add_prescan_overscan(self, chip, filt, tel, pointing, catalog, obs_param):
...
@@ -17,13 +17,52 @@ def add_prescan_overscan(self, chip, filt, tel, pointing, catalog, obs_param):
over1
=
chip
.
overscan_x
,
over1
=
chip
.
overscan_x
,
over2
=
chip
.
overscan_y
)
over2
=
chip
.
overscan_y
)
if
obs_param
[
"add_dark"
]
==
True
:
if
obs_param
[
"add_dark"
]
is
True
:
ny
=
int
(
chip
.
npix_y
/
2
)
ny
=
int
(
chip
.
npix_y
/
2
)
base_dark
=
(
ny
-
1
)
*
(
chip
.
readout_time
/
ny
)
*
chip
.
dark_noise
base_dark
=
(
ny
-
1
)
*
(
chip
.
readout_time
/
ny
)
*
chip
.
dark_noise
chip
.
img
.
array
[(
chip
.
prescan_y
+
ny
):
-
(
chip
.
prescan_y
+
ny
),
:]
=
base_dark
chip
.
img
.
array
[(
chip
.
prescan_y
+
ny
):
-
(
chip
.
prescan_y
+
ny
),
:]
=
base_dark
return
chip
,
filt
,
tel
,
pointing
return
chip
,
filt
,
tel
,
pointing
def
add_crosstalk
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
crosstalk
=
np
.
zeros
([
16
,
16
])
crosstalk
[
0
,:]
=
np
.
array
([
1.
,
1e-4
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
])
crosstalk
[
1
,:]
=
np
.
array
([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
,
0.
,
0.
])
crosstalk
[
11
,:]
=
np
.
array
([
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
1e-4
,
1.
,
0.
,
0.
,
0.
,
0.
])
crosstalk
[
12
,:]
=
np
.
array
([
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
1.
,
1e-4
,
0.
,
0.
])
crosstalk
[
13
,:]
=
np
.
array
([
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
1e-4
,
1.
,
0.
,
0.
])
crosstalk
[
14
,:]
=
np
.
array
([
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
1.
,
1e-4
])
crosstalk
[
15
,:]
=
np
.
array
([
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
1e-4
,
1.
])
# 2*8 -> 1*16
img
=
formatOutput
(
chip
.
img
)
ny
,
nx
=
img
.
array
.
shape
nsecy
=
1
nsecx
=
16
dy
=
int
(
ny
/
nsecy
)
dx
=
int
(
nx
/
nsecx
)
newimg
=
galsim
.
Image
(
nx
,
ny
,
init_value
=
0
)
for
i
in
range
(
16
):
for
j
in
range
(
16
):
newimg
.
array
[:,
int
(
i
*
dx
):
int
(
i
*
dx
+
dx
)]
+=
crosstalk
[
i
,
j
]
*
img
.
array
[:,
int
(
j
*
dx
):
int
(
j
*
dx
+
dx
)]
# 1*16 -> 2*8
newimg
=
formatRevert
(
newimg
)
chip
.
img
.
array
[:,
:]
=
newimg
.
array
[:,
:]
return
chip
,
filt
,
tel
,
pointing
def
add_readout_noise
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
def
add_readout_noise
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
seed
=
int
(
self
.
overall_config
[
"random_seeds"
]
seed
=
int
(
self
.
overall_config
[
"random_seeds"
]
[
"seed_readout"
])
+
pointing
.
id
*
30
+
chip
.
chipID
[
"seed_readout"
])
+
pointing
.
id
*
30
+
chip
.
chipID
...
@@ -36,13 +75,13 @@ def add_readout_noise(self, chip, filt, tel, pointing, catalog, obs_param):
...
@@ -36,13 +75,13 @@ def add_readout_noise(self, chip, filt, tel, pointing, catalog, obs_param):
def
apply_gain
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
def
apply_gain
(
self
,
chip
,
filt
,
tel
,
pointing
,
catalog
,
obs_param
):
self
.
chip_output
.
Log_info
(
" Applying Gain"
)
self
.
chip_output
.
Log_info
(
" Applying Gain"
)
if
obs_param
[
"gain_16channel"
]
==
True
:
if
obs_param
[
"gain_16channel"
]
is
True
:
chip
.
img
,
chip
.
gain_channel
=
effects
.
ApplyGainNonUniform16
(
chip
.
img
,
chip
.
img
,
chip
.
gain_channel
=
effects
.
ApplyGainNonUniform16
(
chip
.
img
,
gain
=
chip
.
gain
,
gain
=
chip
.
gain
,
nsecy
=
chip
.
nsecy
,
nsecy
=
chip
.
nsecy
,
nsecx
=
chip
.
nsecx
,
nsecx
=
chip
.
nsecx
,
seed
=
self
.
overall_config
[
"random_seeds"
][
"seed_gainNonUniform"
]
+
chip
.
chipID
)
seed
=
self
.
overall_config
[
"random_seeds"
][
"seed_gainNonUniform"
]
+
chip
.
chipID
)
elif
obs_param
[
"gain_16channel"
]
==
False
:
elif
obs_param
[
"gain_16channel"
]
is
False
:
chip
.
img
/=
chip
.
gain
chip
.
img
/=
chip
.
gain
chip
.
gain_channel
=
np
.
ones
(
chip
.
nsecy
*
chip
.
nsecx
)
*
chip
.
gain
chip
.
gain_channel
=
np
.
ones
(
chip
.
nsecy
*
chip
.
nsecx
)
*
chip
.
gain
return
chip
,
filt
,
tel
,
pointing
return
chip
,
filt
,
tel
,
pointing
...
@@ -74,7 +113,7 @@ def quantization_and_output(self, chip, filt, tel, pointing, catalog, obs_param)
...
@@ -74,7 +113,7 @@ def quantization_and_output(self, chip, filt, tel, pointing, catalog, obs_param)
self
.
updateHeaderInfo
(
header_flag
=
'ext'
,
keys
=
[
'GAIN01'
,
'GAIN02'
,
'GAIN03'
,
'GAIN04'
,
'GAIN05'
,
'GAIN06'
,
'GAIN07'
,
self
.
updateHeaderInfo
(
header_flag
=
'ext'
,
keys
=
[
'GAIN01'
,
'GAIN02'
,
'GAIN03'
,
'GAIN04'
,
'GAIN05'
,
'GAIN06'
,
'GAIN07'
,
'GAIN08'
,
'GAIN09'
,
'GAIN10'
,
'GAIN11'
,
'GAIN12'
,
'GAIN13'
,
'GAIN14'
,
'GAIN15'
,
'GAIN16'
],
values
=
gains
)
'GAIN08'
,
'GAIN09'
,
'GAIN10'
,
'GAIN11'
,
'GAIN12'
,
'GAIN13'
,
'GAIN14'
,
'GAIN15'
,
'GAIN16'
],
values
=
gains
)
if
obs_param
[
"format_output"
]
==
True
:
if
obs_param
[
"format_output"
]
is
True
:
self
.
chip_output
.
Log_info
(
" Apply 1*16 format"
)
self
.
chip_output
.
Log_info
(
" Apply 1*16 format"
)
chip
.
img
=
chip_utils
.
formatOutput
(
GSImage
=
chip
.
img
)
chip
.
img
=
chip_utils
.
formatOutput
(
GSImage
=
chip
.
img
)
chip
.
nsecy
=
1
chip
.
nsecy
=
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