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
e2688095
Commit
e2688095
authored
Apr 15, 2024
by
Chen Yili
Browse files
Upload New File
parent
c5612144
Changes
1
Show whitespace changes
Inline
Side-by-side
CpicImgSim/config.py
0 → 100644
View file @
e2688095
import
os
,
yaml
import
warnings
cpism_refdata
=
'D:/CPIC_image_process/cpic-img-sim-master/cpism_refdata'
if
not
os
.
path
.
exists
(
cpism_refdata
):
# pragma: no cover
raise
Exception
(
"Can not find CPISM reference data."
)
if
not
os
.
path
.
exists
(
os
.
environ
.
get
(
'PYSYN_CDBS'
,
'./trd'
)):
# pragma: no cover
raise
Exception
(
"Can not find PYSYN Stellar reference data."
)
# we need to ignore the warning from pysynphot, because we only use the star models.
with
warnings
.
catch_warnings
():
# pragma: no cover
warnings
.
filterwarnings
(
"ignore"
)
import
pysynphot
as
S
solar_spectrum
=
S
.
FileSpectrum
(
f
"
{
os
.
environ
[
'PYSYN_CDBS'
]
}
/grid/solsys/solar_spec.fits"
)
solar_spectrum
.
convert
(
'photlam'
)
config_file
=
cpism_refdata
+
'/optics/optics_config.yaml'
if
not
os
.
path
.
exists
(
config_file
):
# pragma: no cover
raise
FileNotFoundError
(
f
"光学配置文件不存在(
{
config_file
}
)"
)
with
open
(
config_file
,
'r'
)
as
f
:
optics_config
=
yaml
.
load
(
f
,
Loader
=
yaml
.
FullLoader
)
MAG_SYSTEM
=
'abmag'
__version__
=
'1.0.0'
def
which_focalplane
(
band
):
"""
Return the name of the focalplane which the band belongs to.
Parameters
-----------
band: str
The name of the band.
from ['f565', 'f661', 'f743', 'f883', 'f940', 'f1265', 'f1425', 'f1542', 'wfs']
Returns
--------
str
The name of the focalplane.
'vis' or 'nir' or 'wfs'
Raises
-------
ValueError
If the band is not in ['f565', 'f661', 'f743', 'f883', 'f940', 'f1265', 'f1425', 'f1542', 'wfs']
"""
band
=
band
.
lower
()
if
band
in
[
'f520'
,
'f662'
,
'f720'
,
'f850'
]:
return
'vis'
if
band
in
[
'f940'
,
'f1265'
,
'f1425'
,
'f1542'
]:
return
'nir'
if
band
in
[
'wfs'
]:
return
'wfs'
raise
ValueError
(
f
"未知的波段
{
band
}
"
)
\ No newline at end of file
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