Commit 4a53823c authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

added params module

parents
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)
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