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
Liu Dezi
csst_msc_sim
Commits
4e616043
Commit
4e616043
authored
Jun 27, 2022
by
Fang Yuedong
Browse files
Merge branch 'master' of
ssh://119.78.210.97:31415/data/simudata/CSSOSDataProductsSims/codes/CSST
parents
f0c3ca84
d5839380
Changes
11
Show whitespace changes
Inline
Side-by-side
Catalog/NGPCatalog.py
View file @
4e616043
ObservationSim/Instrument/Filter.py
View file @
4e616043
...
...
@@ -39,12 +39,12 @@ class Filter(object):
self
.
mag_limiting
=
filter_param
.
param
[
filter_type
][
7
]
# self.filter_dir = filter_param.filter_dir
def
is_too_bright
(
self
,
mag
):
return
mag
<=
self
.
mag_saturation
-
2.5
def
is_too_bright
(
self
,
mag
,
margin
=-
2.5
):
return
mag
<=
self
.
mag_saturation
+
margin
# return mag <= 14.0
def
is_too_dim
(
self
,
mag
):
return
mag
>=
self
.
mag_limiting
+
1.0
def
is_too_dim
(
self
,
mag
,
margin
=
1.0
):
return
mag
>=
self
.
mag_limiting
+
margin
def
_get_bandpasses
(
self
,
filter_dir
=
None
,
unit
=
'A'
):
if
self
.
filter_id
<
7
:
# Photometric
...
...
ObservationSim/MockObject/CatalogBase.py
View file @
4e616043
...
...
@@ -88,7 +88,7 @@ class CatalogBase(metaclass=ABCMeta):
bandpass
=
bandpass
)
if
target_filt
.
survey_type
==
"photometric"
:
return
sed_photon
,
mag_csst
return
sed_photon
,
mag_csst
,
interFlux
elif
target_filt
.
survey_type
==
"spectroscopic"
:
del
sed_photon
return
sed
,
mag_csst
\ No newline at end of file
return
sed
,
mag_csst
,
interFlux
\ No newline at end of file
ObservationSim/MockObject/MockObject.py
View file @
4e616043
...
...
@@ -55,15 +55,20 @@ class MockObject(object):
# (TEST) stamp size
# return 13.0
def
getFluxFilter
(
self
,
filt
):
return
self
.
param
[
"flux_%s"
%
filt
.
filter_type
]
def
getNumPhotons
(
self
,
flux
,
tel
,
exptime
=
150.
):
pupil_area
=
tel
.
pupil_area
*
(
100.
)
**
2
# m^2 to cm^2
return
flux
*
pupil_area
*
exptime
def
getElectronFluxFilt
(
self
,
filt
,
tel
,
exptime
=
150.
):
photonEnergy
=
filt
.
getPhotonE
()
flux
=
magToFlux
(
self
.
getMagFilter
(
filt
))
factor
=
1.0e4
*
flux
/
photonEnergy
*
VC_A
*
(
1.0
/
filt
.
blue_limit
-
1.0
/
filt
.
red_limit
)
return
factor
*
filt
.
efficiency
*
tel
.
pupil_area
*
exptime
# photonEnergy = filt.getPhotonE()
# flux = magToFlux(self.getMagFilter(filt))
# factor = 1.0e4 * flux/photonEnergy * VC_A * (1.0/filt.blue_limit - 1.0/filt.red_limit)
# return factor * filt.efficiency * tel.pupil_area * exptime
flux
=
self
.
getFluxFilter
(
filt
)
return
flux
*
tel
.
pupil_area
*
exptime
def
getPosWorld
(
self
):
ra
=
self
.
param
[
"ra"
]
...
...
ObservationSim/ObservationSim.py
View file @
4e616043
...
...
@@ -193,13 +193,13 @@ class Observation(object):
try
:
sed_data
=
self
.
cat
.
load_sed
(
obj
)
norm_filt
=
self
.
cat
.
load_norm_filt
(
obj
)
obj
.
sed
,
obj
.
param
[
"mag_%s"
%
filt
.
filter_type
]
=
self
.
cat
.
convert_sed
(
obj
.
sed
,
obj
.
param
[
"mag_%s"
%
filt
.
filter_type
]
,
obj
.
param
[
"flux_%s"
%
filt
.
filter_type
]
=
self
.
cat
.
convert_sed
(
mag
=
obj
.
param
[
"mag_use_normal"
],
sed
=
sed_data
,
target_filt
=
filt
,
norm_filt
=
norm_filt
,
)
_
,
obj
.
param
[
"mag_%s"
%
cut_filter
.
filter_type
]
=
self
.
cat
.
convert_sed
(
_
,
obj
.
param
[
"mag_%s"
%
cut_filter
.
filter_type
]
,
obj
.
param
[
"flux_%s"
%
cut_filter
.
filter_type
]
=
self
.
cat
.
convert_sed
(
mag
=
obj
.
param
[
"mag_use_normal"
],
sed
=
sed_data
,
target_filt
=
cut_filter
,
...
...
@@ -216,13 +216,17 @@ class Observation(object):
# Exclude very bright/dim objects (for now)
# if filt.is_too_bright(mag=obj.getMagFilter(filt)):
# if filt.is_too_bright(mag=obj.mag_use_normal):
if
cut_filter
.
is_too_bright
(
mag
=
obj
.
param
[
"mag_%s"
%
self
.
config
[
"obs_setting"
][
"cut_in_band"
].
lower
()]):
if
cut_filter
.
is_too_bright
(
mag
=
obj
.
param
[
"mag_%s"
%
self
.
config
[
"obs_setting"
][
"cut_in_band"
].
lower
()],
margin
=
self
.
config
[
"obs_setting"
][
"mag_sat_margin"
]):
# print("obj too birght!!", flush=True)
if
obj
.
type
!=
'galaxy'
:
bright_obj
+=
1
obj
.
unload_SED
()
continue
if
filt
.
is_too_dim
(
mag
=
obj
.
getMagFilter
(
filt
)):
if
filt
.
is_too_dim
(
mag
=
obj
.
getMagFilter
(
filt
),
margin
=
self
.
config
[
"obs_setting"
][
"mag_lim_margin"
]):
# if cut_filter.is_too_dim(mag=obj.param["mag_%s"%self.config["obs_setting"]["cut_in_band"].lower()]):
# print("obj too dim!!", flush=True)
dim_obj
+=
1
...
...
config/config_C3.yaml
View file @
4e616043
...
...
@@ -2,7 +2,7 @@
###############################################
#
# Configuration file for CSST simulation
# CSST-Sim Group, 2021/10/07
, version 0.3
# CSST-Sim Group, 2021/10/07
#
###############################################
...
...
config/config_NGP.yaml
View file @
4e616043
...
...
@@ -2,7 +2,7 @@
###############################################
#
# Configuration file for CSST simulation
# CSST-Sim Group, 2021/10/07
, version 0.3
# CSST-Sim Group, 2021/10/07
#
###############################################
...
...
config/config_NGP_dev.yaml
View file @
4e616043
...
...
@@ -12,14 +12,16 @@
# work_dir: "/public/home/fangyuedong/sim_code_release/CSST/test/"
work_dir
:
"
/public/home/fangyuedong/test/CSST/workplace/"
data_dir
:
"
/data/simudata/CSSOSDataProductsSims/data/"
run_name
:
"
TEST_16channel_off
"
run_name
:
"
v0.5_TEST
"
# (Optional) a file of point list
# if you just want to run default pointing:
# - pointing_dir: null
# - pointing_file: null
pointing_dir
:
"
/data/simudata/CSSOSDataProductsSims/data/"
# pointing_dir: "/data/simudata/CSSOSDataProductsSims/data/"
pointing_dir
:
"
/public/home/fangyuedong/test/CSST/test_20220622/"
pointing_file
:
"
pointing_test_NGP_2.17.dat"
# pointing_file: "pointing_test_case2.dat"
# Whether to use MPI
run_option
:
...
...
@@ -79,7 +81,7 @@ obs_setting:
# - give a list of indexes of chips: [ip_1, ip_2...]
# - run all chips: null
# Note: for all pointings
run_chips
:
[
24
]
run_chips
:
null
# Whether to enable astrometric modeling
# astrometric_lib: "libshao.so"
...
...
@@ -88,6 +90,12 @@ obs_setting:
# Cut by saturation/limiting magnitude in which band?
cut_in_band
:
"
g"
# saturation magnitude margin
mag_sat_margin
:
-2.5
# limiting magnitude margin
mag_lim_margin
:
+1.0
###############################################
# Input path setting
###############################################
...
...
config/config_example.yaml
View file @
4e616043
...
...
@@ -2,7 +2,7 @@
###############################################
#
# Configuration file for CSST simulation
# CSST-Sim Group, 2021/10/07
, version 0.3
# CSST-Sim Group, 2021/10/07
#
###############################################
...
...
run_sim.py
View file @
4e616043
...
...
@@ -49,10 +49,14 @@ def run_sim(Catalog):
config
[
'work_dir'
]
=
args
.
work_dir
# Some default values
if
"bias_16channel"
not
in
config
:
config
[
"bias_16channel"
]
=
False
if
"gain_16channel"
not
in
config
:
config
[
"gain_16channel"
]
=
False
if
"bias_16channel"
not
in
config
[
"ins_effects"
]:
config
[
"ins_effects"
][
"bias_16channel"
]
=
False
if
"gain_16channel"
not
in
config
[
"ins_effects"
]:
config
[
"ins_effects"
][
"gain_16channel"
]
=
False
if
"mag_sat_margin"
not
in
config
[
"obs_setting"
]:
config
[
"obs_setting"
][
"mag_sat_margin"
]
=
-
2.5
if
"mag_lim_margin"
not
in
config
[
"obs_setting"
]:
config
[
"obs_setting"
][
"mag_lim_margin"
]
=
1.0
# Generate lists pointings based on the input pointing list (or default
# pointing RA, DEC) and "config["obs_setting"]["run_pointings"]".
...
...
setup.py
View file @
4e616043
...
...
@@ -26,7 +26,7 @@ extensions = [
setup
(
name
=
'CSSTSim'
,
version
=
'0.5'
,
version
=
'0.5
.1
'
,
packages
=
find_packages
(),
# install_requires=[
# 'numpy>=1.18.5',
...
...
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