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-pipeline
csst_common
Commits
4a53823c
Commit
4a53823c
authored
Aug 27, 2022
by
BO ZHANG
🏀
Browse files
added params module
parents
Changes
2
Show whitespace changes
Inline
Side-by-side
csst_common/__init__.py
0 → 100644
View file @
4a53823c
csst_common/params.py
0 → 100644
View file @
4a53823c
class
BasicParams
:
""" the basic parameter class """
def
__repr__
(
self
):
_class_name
=
self
.
__class__
.
__name__
_str
=
"<{}>
\n
{}
\n
"
.
format
(
_class_name
,
"-"
*
(
len
(
_class_name
)
+
2
))
for
k
,
v
in
self
.
__dict__
.
items
():
_str
+=
"{}:{}
\n
"
.
format
(
k
,
v
)
return
_str
# def to_dict(self):
# """ convert to a dictionary """
# _dict = {}
# for attr in self.__dir__():
# if not attr.startswith("_"):
# _dict[attr] = self.__getattribute__(attr)
# return _dict
class
CsstParams
(
BasicParams
):
""" CSST parameters -- a collection of """
def
__init__
(
self
):
self
.
mbi
=
CsstMbiParams
()
self
.
sls
=
CsstSlsParams
()
self
.
sim
=
CsstSimParams
()
def
__repr__
(
self
):
_class_name
=
self
.
__class__
.
__name__
_str
=
"<{}>
\n
{}
\n
"
.
format
(
_class_name
,
"-"
*
(
len
(
_class_name
)
+
2
))
for
k
,
v
in
self
.
__dict__
.
items
():
_str
+=
"{}:
\n
"
.
format
(
k
)
for
kk
in
self
.
__getattribute__
(
k
).
__dict__
.
keys
():
_str
+=
"
\t
{}
\n
"
.
format
(
kk
)
return
_str
class
CsstMbiParams
(
BasicParams
):
""" multi-band imaging parameters """
def
__init__
(
self
):
# define DETECTOR ID list
self
.
DETECTORS
=
[
6
,
7
,
8
,
9
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
22
,
23
,
24
,
25
]
self
.
FILTERS
=
[
'N'
,
'u'
,
'g'
,
'r'
,
'i'
,
'z'
,
'y'
]
# define DETECTOR -> FILTER mapping
self
.
DETECTOR2FILTER
=
{
6
:
"y"
,
7
:
"i"
,
8
:
"g"
,
9
:
"r"
,
11
:
"z"
,
12
:
"nuv"
,
13
:
"nuv"
,
14
:
"u"
,
15
:
"y"
,
16
:
"y"
,
17
:
"u"
,
18
:
"nuv"
,
19
:
"nuv"
,
20
:
"z"
,
22
:
"r"
,
23
:
"g"
,
24
:
"i"
,
25
:
"y"
,
}
class
CsstSlsParams
(
BasicParams
):
""" slit-less spectra parameters """
pass
class
CsstSimParams
(
BasicParams
):
""" simulation parameters """
def
__init__
(
self
):
# define versions of simulation
# C denotes for Cycle
self
.
VER_SIMS
=
[
"C3"
,
"C5.1"
,
"C5.2"
]
if
__name__
==
"__main__"
:
cp
=
CsstParams
()
print
(
cp
)
print
(
cp
.
mbi
)
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