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
Wu Jin
CSST simulation
Commits
2c1eaa56
Commit
2c1eaa56
authored
Jan 10, 2022
by
Fang Yuedong
Browse files
minor change in config files
parent
ae6b8921
Changes
4
Hide whitespace changes
Inline
Side-by-side
Catalog/C3Catalog.py
View file @
2c1eaa56
...
...
@@ -30,13 +30,13 @@ class C3Catalog(CatalogBase):
self
.
chip
=
chip
self
.
pointing
=
pointing
if
"star_cat"
in
config
[
"input_path"
]
and
config
[
"input_path"
][
"star_cat"
]
and
not
config
[
"galaxy_only"
]:
if
"star_cat"
in
config
[
"input_path"
]
and
config
[
"input_path"
][
"star_cat"
]
and
not
config
[
"
run_option"
][
"
galaxy_only"
]:
star_file
=
config
[
"input_path"
][
"star_cat"
]
star_SED_file
=
config
[
"SED_templates_path"
][
"star_SED"
]
self
.
star_path
=
os
.
path
.
join
(
self
.
cat_dir
,
star_file
)
self
.
star_SED_path
=
os
.
path
.
join
(
config
[
"data_dir"
],
star_SED_file
)
self
.
_load_SED_lib_star
()
if
"galaxy_cat"
in
config
[
"input_path"
]
and
config
[
"input_path"
][
"galaxy_cat"
]
and
not
config
[
"star_only"
]:
if
"galaxy_cat"
in
config
[
"input_path"
]
and
config
[
"input_path"
][
"galaxy_cat"
]
and
not
config
[
"
run_option"
][
"
star_only"
]:
galaxy_file
=
config
[
"input_path"
][
"galaxy_cat"
]
self
.
galaxy_path
=
os
.
path
.
join
(
self
.
cat_dir
,
galaxy_file
)
self
.
galaxy_SED_path
=
os
.
path
.
join
(
config
[
"data_dir"
],
config
[
"SED_templates_path"
][
"galaxy_SED"
])
...
...
@@ -192,13 +192,13 @@ class C3Catalog(CatalogBase):
self
.
avGal
=
extAv
(
self
.
nav
,
seed
=
self
.
seed_Av
)
self
.
objs
=
[]
self
.
ids
=
0
if
"star_cat"
in
self
.
config
[
"input_path"
]
and
self
.
config
[
"input_path"
][
"star_cat"
]
and
not
self
.
config
[
"galaxy_only"
]:
if
"star_cat"
in
self
.
config
[
"input_path"
]
and
self
.
config
[
"input_path"
][
"star_cat"
]
and
not
self
.
config
[
"
run_option"
][
"
galaxy_only"
]:
star_cat
=
h5
.
File
(
self
.
star_path
,
'r'
)[
'catalog'
]
for
pix
in
self
.
pix_list
:
stars
=
star_cat
[
str
(
pix
)]
self
.
_load_stars
(
stars
,
pix_id
=
pix
)
del
stars
if
"galaxy_cat"
in
self
.
config
[
"input_path"
]
and
self
.
config
[
"input_path"
][
"galaxy_cat"
]
and
not
self
.
config
[
"star_only"
]:
if
"galaxy_cat"
in
self
.
config
[
"input_path"
]
and
self
.
config
[
"input_path"
][
"galaxy_cat"
]
and
not
self
.
config
[
"
run_option"
][
"
star_only"
]:
gals_cat
=
h5
.
File
(
self
.
galaxy_path
,
'r'
)[
'galaxies'
]
for
pix
in
self
.
pix_list
:
gals
=
gals_cat
[
str
(
pix
)]
...
...
ObservationSim/ObservationSim.py
View file @
2c1eaa56
...
...
@@ -123,11 +123,11 @@ class Observation(object):
# if j >= 100:
# break
obj
=
self
.
cat
.
objs
[
j
]
if
obj
.
type
==
'star'
and
self
.
config
[
"galaxy_only"
]:
if
obj
.
type
==
'star'
and
self
.
config
[
"
run_option"
][
"
galaxy_only"
]:
continue
elif
obj
.
type
==
'galaxy'
and
self
.
config
[
"star_only"
]:
elif
obj
.
type
==
'galaxy'
and
self
.
config
[
"
run_option"
][
"
star_only"
]:
continue
elif
obj
.
type
==
'quasar'
and
self
.
config
[
"star_only"
]:
elif
obj
.
type
==
'quasar'
and
self
.
config
[
"
run_option"
][
"
star_only"
]:
continue
# load SED
...
...
@@ -185,9 +185,9 @@ class Observation(object):
# Draw object & update output catalog
try
:
if
self
.
config
[
"out_cat_only"
]:
if
self
.
config
[
"
run_option"
][
"
out_cat_only"
]:
isUpdated
=
True
if
chip
.
survey_type
==
"photometric"
and
not
self
.
config
[
"out_cat_only"
]:
if
chip
.
survey_type
==
"photometric"
and
not
self
.
config
[
"
run_option"
][
"
out_cat_only"
]:
isUpdated
,
pos_shear
=
obj
.
drawObj_multiband
(
tel
=
self
.
tel
,
pos_img
=
pos_img
,
...
...
@@ -199,7 +199,7 @@ class Observation(object):
g2
=
obj
.
param
[
"g2"
],
exptime
=
pointing
.
exp_time
)
elif
chip
.
survey_type
==
"spectroscopic"
and
not
self
.
config
[
"out_cat_only"
]:
elif
chip
.
survey_type
==
"spectroscopic"
and
not
self
.
config
[
"
run_option"
][
"
out_cat_only"
]:
isUpdated
,
pos_shear
=
obj
.
drawObj_slitless
(
tel
=
self
.
tel
,
pos_img
=
pos_img
,
...
...
config/config_C3.yaml
View file @
2c1eaa56
...
...
@@ -30,15 +30,15 @@ run_option:
# in order to config the number of threads to request from NAOC cluster
n_threads
:
80
# Output catalog only?
# If yes, no imaging simulation will run
out_cat_only
:
NO
# Output catalog only?
# If yes, no imaging simulation will run
out_cat_only
:
NO
# Only simulate stars?
star_only
:
YES
# Only simulate stars?
star_only
:
YES
# Only simulate galaxies?
galaxy_only
:
NO
# Only simulate galaxies?
galaxy_only
:
NO
###############################################
# Observation setting
...
...
config/config_example.yaml
View file @
2c1eaa56
...
...
@@ -28,16 +28,15 @@ run_option:
# simulation codes. It should be implemented later in the web frontend
# in order to config the number of threads to request from NAOC cluster
n_threads
:
40
# Output catalog only?
# If yes, no imaging simulation will run
out_cat_only
:
NO
# Output catalog only?
# If yes, no imaging simulation will run
out_cat_only
:
NO
# Only simulate stars?
star_only
:
NO
# Only simulate stars?
star_only
:
NO
# Only simulate galaxies?
galaxy_only
:
NO
# Only simulate galaxies?
galaxy_only
:
NO
###############################################
# Observation setting
...
...
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