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
428f2c1e
Commit
428f2c1e
authored
May 21, 2025
by
Zhang Xin
Browse files
pep8
parent
4168b748
Pipeline
#8346
passed with stage
in 0 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
observation_sim/_util.py
View file @
428f2c1e
...
@@ -26,7 +26,7 @@ def parse_args():
...
@@ -26,7 +26,7 @@ def parse_args():
return
parser
.
parse_args
()
return
parser
.
parse_args
()
def
generate_pointing_list
(
config
,
pointing_filename
=
None
,
data_dir
=
None
,
dataset
=
''
):
def
generate_pointing_list
(
config
,
pointing_filename
=
None
,
data_dir
=
None
,
dataset
=
''
):
pointing_list
=
[]
pointing_list
=
[]
# Only valid when the pointing list does not contain time stamp column
# Only valid when the pointing list does not contain time stamp column
...
@@ -63,7 +63,8 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None, datase
...
@@ -63,7 +63,8 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None, datase
continue
continue
line
=
line
.
strip
()
line
=
line
.
strip
()
columns
=
line
.
split
()
columns
=
line
.
split
()
pointing
=
Pointing
(
obs_config_file
=
obs_config_file
,
dataset
=
dataset
)
pointing
=
Pointing
(
obs_config_file
=
obs_config_file
,
dataset
=
dataset
)
pointing
.
read_pointing_columns
(
columns
=
columns
,
id
=
ipoint
)
pointing
.
read_pointing_columns
(
columns
=
columns
,
id
=
ipoint
)
t
+=
delta_t
*
60.
t
+=
delta_t
*
60.
pointing_list
.
append
(
pointing
)
pointing_list
.
append
(
pointing
)
...
@@ -83,7 +84,7 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None, datase
...
@@ -83,7 +84,7 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None, datase
timestamp
=
t
,
timestamp
=
t
,
exp_time
=
exp_time
,
exp_time
=
exp_time
,
pointing_type
=
'SCI'
,
pointing_type
=
'SCI'
,
obs_config_file
=
obs_config_file
,
obs_config_file
=
obs_config_file
,
dataset
=
dataset
dataset
=
dataset
)
)
t
+=
delta_t
*
60.
t
+=
delta_t
*
60.
...
...
observation_sim/config/Pointing.py
View file @
428f2c1e
...
@@ -10,7 +10,7 @@ import observation_sim.instruments._util as _util
...
@@ -10,7 +10,7 @@ import observation_sim.instruments._util as _util
class
Pointing
(
object
):
class
Pointing
(
object
):
def
__init__
(
self
,
id
=
0
,
ra
=
0.
,
dec
=
0.
,
img_pa
=
0.
,
timestamp
=
1621915200
,
sat_x
=
0.
,
sat_y
=
0.
,
sat_z
=
0.
,
sun_x
=
0.
,
sun_y
=
0.
,
sun_z
=
0.
,
sat_vx
=
0.
,
sat_vy
=
0.
,
sat_vz
=
0.
,
exp_time
=
150.
,
pointing_type
=
'SCI'
,
pointing_type_code
=
'101'
,
pointing_id
=
'00000001'
,
obs_config_file
=
None
,
t_shutter_open
=
1.3
,
t_shutter_close
=
1.3
,
dataset
=
'csst-msc-c9-25sqdeg-v3'
):
def
__init__
(
self
,
id
=
0
,
ra
=
0.
,
dec
=
0.
,
img_pa
=
0.
,
timestamp
=
1621915200
,
sat_x
=
0.
,
sat_y
=
0.
,
sat_z
=
0.
,
sun_x
=
0.
,
sun_y
=
0.
,
sun_z
=
0.
,
sat_vx
=
0.
,
sat_vy
=
0.
,
sat_vz
=
0.
,
exp_time
=
150.
,
pointing_type
=
'SCI'
,
pointing_type_code
=
'101'
,
pointing_id
=
'00000001'
,
obs_config_file
=
None
,
t_shutter_open
=
1.3
,
t_shutter_close
=
1.3
,
dataset
=
'csst-msc-c9-25sqdeg-v3'
):
self
.
id
=
id
self
.
id
=
id
self
.
ra
=
ra
self
.
ra
=
ra
self
.
dec
=
dec
self
.
dec
=
dec
...
...
observation_sim/config/header/ImageHeader.py
View file @
428f2c1e
...
@@ -355,7 +355,7 @@ def WCS_def(xlen=9216, ylen=9232, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=60,
...
@@ -355,7 +355,7 @@ def WCS_def(xlen=9216, ylen=9232, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=60,
# TODO project_cycle is temporary, is not in header defined, delete in future
# TODO project_cycle is temporary, is not in header defined, delete in future
def
generatePrimaryHeader
(
xlen
=
9216
,
ylen
=
9232
,
pointing_id
=
'00000001'
,
pointing_type_code
=
'101'
,
ra
=
60
,
dec
=-
40
,
pixel_scale
=
0.074
,
time_pt
=
None
,
im_type
=
'SCI'
,
exptime
=
150.
,
sat_pos
=
[
0.
,
0.
,
0.
],
sat_vel
=
[
0.
,
0.
,
0.
],
project_cycle
=
6
,
run_counter
=
0
,
chip_name
=
"01"
,
obstype
=
'WIDE'
,
dataset
=
'csst-msc-c9-25sqdeg-v3'
):
def
generatePrimaryHeader
(
xlen
=
9216
,
ylen
=
9232
,
pointing_id
=
'00000001'
,
pointing_type_code
=
'101'
,
ra
=
60
,
dec
=-
40
,
pixel_scale
=
0.074
,
time_pt
=
None
,
im_type
=
'SCI'
,
exptime
=
150.
,
sat_pos
=
[
0.
,
0.
,
0.
],
sat_vel
=
[
0.
,
0.
,
0.
],
project_cycle
=
6
,
run_counter
=
0
,
chip_name
=
"01"
,
obstype
=
'WIDE'
,
dataset
=
'csst-msc-c9-25sqdeg-v3'
):
# array_size1, array_size2, flux, sigma = int(argv[1]), int(argv[2]), 1000.0, 5.0
# array_size1, array_size2, flux, sigma = int(argv[1]), int(argv[2]), 1000.0, 5.0
...
@@ -432,7 +432,7 @@ def generatePrimaryHeader(xlen=9216, ylen=9232, pointing_id='00000001', pointing
...
@@ -432,7 +432,7 @@ def generatePrimaryHeader(xlen=9216, ylen=9232, pointing_id='00000001', pointing
# h_prim['FILETYPE'] = get_file_type(img_type=im_type)
# h_prim['FILETYPE'] = get_file_type(img_type=im_type)
# h_prim['FILETYPE'] = im_type
# h_prim['FILETYPE'] = im_type
h_prim
[
'OBSTYPE'
]
=
obstype
h_prim
[
'OBSTYPE'
]
=
obstype
h_prim
[
'DATASET'
]
=
dataset
h_prim
[
'DATASET'
]
=
dataset
co
=
coord
.
SkyCoord
(
ra
,
dec
,
unit
=
'deg'
)
co
=
coord
.
SkyCoord
(
ra
,
dec
,
unit
=
'deg'
)
ra_hms
=
format
(
co
.
ra
.
hms
.
h
,
'02.0f'
)
+
format
(
co
.
ra
.
hms
.
m
,
ra_hms
=
format
(
co
.
ra
.
hms
.
h
,
'02.0f'
)
+
format
(
co
.
ra
.
hms
.
m
,
...
...
observation_sim/mock_objects/Galaxy.py
View file @
428f2c1e
...
@@ -285,7 +285,7 @@ class Galaxy(MockObject):
...
@@ -285,7 +285,7 @@ class Galaxy(MockObject):
for
i
in
range
(
len
(
bandpass_list
)):
for
i
in
range
(
len
(
bandpass_list
)):
branges
[
i
,
0
]
=
bandpass_list
[
i
].
blue_limit
*
10
branges
[
i
,
0
]
=
bandpass_list
[
i
].
blue_limit
*
10
branges
[
i
,
1
]
=
bandpass_list
[
i
].
red_limit
*
10
branges
[
i
,
1
]
=
bandpass_list
[
i
].
red_limit
*
10
for
i
in
range
(
len
(
bandpass_list
)):
for
i
in
range
(
len
(
bandpass_list
)):
# bandpass = bandpass_list[i]
# bandpass = bandpass_list[i]
brange
=
branges
[
i
]
brange
=
branges
[
i
]
...
@@ -363,9 +363,11 @@ class Galaxy(MockObject):
...
@@ -363,9 +363,11 @@ class Galaxy(MockObject):
galImg_List
.
append
(
galImg
)
galImg_List
.
append
(
galImg
)
except
:
except
:
try
:
try
:
psf
,
pos_shear
=
psf_model
.
get_PSF
(
chip
=
chip
,
pos_img
=
pos_img
)
psf
,
pos_shear
=
psf_model
.
get_PSF
(
chip
=
chip
,
pos_img
=
pos_img
)
star_p
=
galsim
.
Convolve
(
psf
,
gal
)
star_p
=
galsim
.
Convolve
(
psf
,
gal
)
galImg
=
star_p
.
drawImage
(
wcs
=
chip_wcs_local
,
offset
=
offset
)
galImg
=
star_p
.
drawImage
(
wcs
=
chip_wcs_local
,
offset
=
offset
)
galImg
.
setOrigin
(
0
,
0
)
galImg
.
setOrigin
(
0
,
0
)
if
np
.
sum
(
np
.
isnan
(
galImg
.
array
))
>
0
:
if
np
.
sum
(
np
.
isnan
(
galImg
.
array
))
>
0
:
# ERROR happens
# ERROR happens
...
...
run_sim.py
View file @
428f2c1e
...
@@ -62,7 +62,7 @@ def run_sim():
...
@@ -62,7 +62,7 @@ def run_sim():
config
[
"project_cycle"
]
=
6
config
[
"project_cycle"
]
=
6
if
"run_counter"
not
in
config
:
if
"run_counter"
not
in
config
:
config
[
"run_counter"
]
=
0
config
[
"run_counter"
]
=
0
if
"data_set"
not
in
config
:
if
"data_set"
not
in
config
:
config
[
"data_set"
]
=
"csst-msc"
config
[
"data_set"
]
=
"csst-msc"
...
@@ -75,7 +75,7 @@ def run_sim():
...
@@ -75,7 +75,7 @@ def run_sim():
if
"pointing_dir"
in
config
[
'obs_setting'
]:
if
"pointing_dir"
in
config
[
'obs_setting'
]:
pointing_dir
=
config
[
'obs_setting'
][
"pointing_dir"
]
pointing_dir
=
config
[
'obs_setting'
][
"pointing_dir"
]
pointing_list
=
generate_pointing_list
(
pointing_list
=
generate_pointing_list
(
config
=
config
,
pointing_filename
=
config
[
'obs_setting'
][
'pointing_file'
],
data_dir
=
pointing_dir
,
dataset
=
config
[
"data_set"
])
config
=
config
,
pointing_filename
=
config
[
'obs_setting'
][
'pointing_file'
],
data_dir
=
pointing_dir
,
dataset
=
config
[
"data_set"
])
# Make the main output directories
# Make the main output directories
run_dir
=
make_run_dirs
(
run_dir
=
make_run_dirs
(
...
...
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