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
c70ee73d
Commit
c70ee73d
authored
Aug 27, 2022
by
BO ZHANG
🏀
Browse files
updated params module
parent
4a53823c
Changes
2
Hide whitespace changes
Inline
Side-by-side
csst_common/__init__.py
View file @
c70ee73d
import
os
__version__
=
"0.0.1"
PACKAGE_PATH
=
os
.
path
.
dirname
(
__file__
)
csst_common/params.py
View file @
c70ee73d
...
...
@@ -3,9 +3,10 @@ class BasicParams:
""" the basic parameter class """
def
__repr__
(
self
):
_class_name
=
self
.
__class__
.
__name__
_str
=
"<{}>
\n
{}
\n
"
.
format
(
_class_name
,
"-"
*
(
len
(
_class_name
)
+
2
))
_str
=
"<{} length={}>"
.
format
(
_class_name
,
len
(
self
.
__dict__
))
_str
+=
"
\n
{}
\n
"
.
format
(
"-"
*
len
(
_str
))
for
k
,
v
in
self
.
__dict__
.
items
():
_str
+=
"{}
:
{}
\n
"
.
format
(
k
,
v
)
_str
+=
"{}
:
{}
\n
"
.
format
(
k
,
v
)
return
_str
# def to_dict(self):
...
...
@@ -20,13 +21,26 @@ class BasicParams:
class
CsstParams
(
BasicParams
):
""" CSST parameters -- a collection of """
def
__init__
(
self
):
"""
This class defines the CSST parameters.
Example
-------
>>> from csst_common.params import CsstParams
>>> cps = CsstParams()
See also
--------
CsstMbiParams, CsstSlsParams, CsstSimParams
"""
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
))
_str
=
"<{} length={}>"
.
format
(
_class_name
,
len
(
self
.
__dict__
))
_str
+=
"
\n
{}
\n
"
.
format
(
"-"
*
len
(
_str
))
for
k
,
v
in
self
.
__dict__
.
items
():
_str
+=
"{}:
\n
"
.
format
(
k
)
for
kk
in
self
.
__getattribute__
(
k
).
__dict__
.
keys
():
...
...
@@ -79,6 +93,8 @@ class CsstSimParams(BasicParams):
self
.
VER_SIMS
=
[
"C3"
,
"C5.1"
,
"C5.2"
]
cp
=
CsstParams
()
if
__name__
==
"__main__"
:
cp
=
CsstParams
()
print
(
cp
)
...
...
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