Commit 8017aa6f authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

added DFS_CONF

parent 381bbf74
---
pml:
CSST_DFS_API_MODE: cluster
CSST_DFS_GATEWAY: 172.24.21.2:30880
CSST_DFS_APP_ID: test
CSST_DFS_APP_TOKEN: test
local:
CSST_DFS_API_MODE: cluster
CSST_DFS_GATEWAY: 222.197.214.168:30880
CSST_DFS_APP_ID: 1
CSST_DFS_APP_TOKEN: 1
......@@ -6,7 +6,8 @@ Author: Bo Zhang
Created: 2022-09-13
Modified-History:
2022-09-13, Bo Zhang, created
2022-09-13, Bo Zhang, fixed a bug
2022-09-13, Bo Zhang, added CSST_PARAMS
2022-10-28, Bo Zhang, added DFS_CONF
"""
import yaml
from . import PACKAGE_PATH
......@@ -14,108 +15,7 @@ from . import PACKAGE_PATH
with open(PACKAGE_PATH + "/data/csst_params.yml") as f:
CSST_PARAMS = yaml.safe_load(f)
with open(PACKAGE_PATH + "/data/dfs_conf.yml") as f:
DFS_CONF = yaml.safe_load(f)
# DEPRECATED BELOW
class BasicParams:
""" the basic parameter class """
def __repr__(self):
_class_name = self.__class__.__name__
_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)
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):
"""
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 = "<{} 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():
_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.VERSIONS = ["C3", "C5.1", "C5.2"]
# cp = CsstParams()
if __name__ == "__main__":
cp = CsstParams()
print(cp)
print(cp.mbi)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment