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_cpic_sim
Commits
66d8b23f
Commit
66d8b23f
authored
Dec 25, 2024
by
GZhao
Browse files
fix 4 bugs in configration test
parent
5174c719
Pipeline
#7612
passed with stage
in 0 seconds
Changes
6
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
csst_cpic_sim/camera.py
View file @
66d8b23f
...
...
@@ -603,7 +603,6 @@ class CpicVisEmccd(object):
bias_level
=
self
.
bias_level
+
np
.
random
.
randn
()
*
self
.
bias_level_std
bias_frame
=
vp_frame
+
ci_frame
+
hp_frame
+
bias_level
bias_frame
+=
rn_adu
*
np
.
random
.
randn
(
shape
[
0
],
shape
[
1
])
+
bias_shift
return
bias_frame
def
nonlinear_effect
(
self
,
image
):
...
...
@@ -874,6 +873,7 @@ class CpicVisEmccd(object):
bias
=
self
.
bias_frame
()
image
=
image
/
self
.
ph_per_adu
+
bias
image
=
np
.
round
(
image
)
image
=
np
.
minimum
(
image
,
self
.
max_adu
)
image
=
np
.
maximum
(
image
,
0
)
...
...
csst_cpic_sim/io.py
View file @
66d8b23f
...
...
@@ -623,4 +623,10 @@ def save_fits(images, obs_info, gnc_info, camera_dict={}, csst_format=True, outp
full_path
=
f
"
{
folder
}
/
{
filename
}
"
log
.
debug
(
f
'save fits file:
{
full_path
}
'
)
for
i
in
range
(
1
,
len
(
hdu_list
)):
# change the comment of keyword XTENSION from 'image extension' to 'extension type'
# in order to meet the requirement of data model
hdu_list
[
i
].
header
.
comments
[
'XTENSION'
]
=
'extension type'
hdu_list
.
writeto
(
full_path
,
overwrite
=
True
)
csst_cpic_sim/main.py
View file @
66d8b23f
...
...
@@ -10,12 +10,15 @@ from datetime import datetime
import
traceback
import
numpy
as
np
from
astropy.io
import
fits
from
.target
import
spectrum_generator
,
target_file_load
from
.optics
import
focal_mask
,
focal_convolve
from
.camera
import
CosmicRayFrameMaker
,
sky_frame_maker
,
CpicVisEmccd
from
.io
import
save_fits
,
log
from
.config
import
update_able_keys
,
relative_time
from
.config
import
config
as
default_config
from
.config
import
config
as
default_config
,
replace_cpism_refdata
from
.psf_simulation
import
actuator
def
vis_observation
(
...
...
@@ -140,7 +143,7 @@ def vis_observation(
platescale
,
camera
.
flat_shape
)
sky_bkg_frame
=
sky_bkg_frame
*
area
*
expt
sky_bkg_frame
=
sky_bkg_frame
*
area
sky_bkg_frame
=
focal_mask
(
sky_bkg_frame
,
iwa
,
platescale
)
cr_frame
=
crmaker
.
make_cr_frame
(
camera
.
dark_shape
,
expt
)
...
...
@@ -313,7 +316,7 @@ def observation_simulation_from_config(obs_file, config_file):
if
config_file
:
with
open
(
config_file
)
as
fid
:
config
=
yaml
.
load
(
fid
,
Loader
=
yaml
.
FullLoader
)
replace_cpism_refdata
(
config
,
output
=
'other'
)
camera_config
=
config
.
get
(
'camera'
,
[{}])
all_camera
=
[]
all_camera_name
=
[]
...
...
@@ -323,6 +326,10 @@ def observation_simulation_from_config(obs_file, config_file):
deduplicate_names_add_count
(
all_camera_name
)
if
'actuator_file'
in
config
.
keys
():
actuator_data
=
fits
.
getdata
(
config
[
'actuator_file'
])
actuator
[:]
=
actuator_data
[:]
for
key
in
config
.
keys
():
if
key
in
update_able_keys
:
default_config
[
key
]
=
config
[
key
]
...
...
example/observations/05_sci.yaml
View file @
66d8b23f
band
:
f662
emgain
:
5
0
emgain
:
20
0
emset
:
-1
expt
:
2
0
expt
:
10
0
nframe
:
2
obsid
:
'
40100000005'
rotation
:
30
...
...
example/run_config.yaml
View file @
66d8b23f
...
...
@@ -37,6 +37,7 @@ camera:
nonlinear
:
false
shutter
:
false
csst_format
:
true
nsample
:
5
nsample
:
10
check_fits_header
:
true
output
:
./example_output/
actuator_file
:
${cpism_refdata}/optics/dark_zone_0011_volt.fits
modelcompare.png
0 → 100644
View file @
66d8b23f
38.9 KB
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