Commit f2ae94cc authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

tweaks

parent 1424860c
...@@ -6,6 +6,7 @@ Author: Bo Zhang ...@@ -6,6 +6,7 @@ Author: Bo Zhang
Created: 2022-09-13 Created: 2022-09-13
Modified-History: Modified-History:
2022-09-13, Bo Zhang, created 2022-09-13, Bo Zhang, created
2022-09-13, Bo Zhang, added CsstMbiDataManager
2022-09-29, Bo Zhang, favor CsstMsDataManager instead of CsstMbiDataManager 2022-09-29, Bo Zhang, favor CsstMsDataManager instead of CsstMbiDataManager
""" """
import os import os
...@@ -40,7 +41,7 @@ class CsstMsDataManager: ...@@ -40,7 +41,7 @@ class CsstMsDataManager:
""" """
def __init__(self, ver_sim="C5.2", dir_l0="", dir_l1="", dir_pcref="", path_aux="", force_all_detectors=False, def __init__(self, ver_sim="C5.2", dir_l0="", dir_l1="", dir_pcref="", path_aux="", assert_all_detectors=False,
datatype="mbi"): datatype="mbi"):
""" initialize the multi-band imaging data manager """ initialize the multi-band imaging data manager
...@@ -54,9 +55,10 @@ class CsstMsDataManager: ...@@ -54,9 +55,10 @@ class CsstMsDataManager:
L1 directory L1 directory
dir_pcref: str dir_pcref: str
position calibration data directory position calibration data directory
will be removed in the next version
path_aux: str path_aux: str
aux data directory (bias, flat, dark) aux data directory (bias, flat, dark)
force_all_detectors: bool assert_all_detectors: bool
if True, assert data for all detectors are available if True, assert data for all detectors are available
datatype: str datatype: str
{"mbi", "sls"} {"mbi", "sls"}
...@@ -84,8 +86,11 @@ class CsstMsDataManager: ...@@ -84,8 +86,11 @@ class CsstMsDataManager:
>>> dm_mbi.l1_file("flipped_image.fits") >>> dm_mbi.l1_file("flipped_image.fits")
""" """
assert ver_sim in CP["sim"]["versions"] assert ver_sim in CP["sim"]["versions"]
self.ver_sim = ver_sim
assert datatype in ["mbi", "sls"] assert datatype in ["mbi", "sls"]
self.datatype = datatype
if datatype == "mbi": if datatype == "mbi":
# MBI # MBI
self.valid_detectors = CP["mbi"]["detectors"] self.valid_detectors = CP["mbi"]["detectors"]
...@@ -107,7 +112,7 @@ class CsstMsDataManager: ...@@ -107,7 +112,7 @@ class CsstMsDataManager:
fps_img = self.glob_image(dir_l0, ver_sim=ver_sim) fps_img = self.glob_image(dir_l0, ver_sim=ver_sim)
fps_cat = self.glob_cat(dir_l0, ver_sim=ver_sim) fps_cat = self.glob_cat(dir_l0, ver_sim=ver_sim)
if force_all_detectors: if assert_all_detectors:
assert len(fps_img) == len(self.valid_detectors) assert len(fps_img) == len(self.valid_detectors)
else: else:
assert len(fps_img) > 0 assert len(fps_img) > 0
...@@ -636,11 +641,11 @@ class CsstMbiDataManager: ...@@ -636,11 +641,11 @@ class CsstMbiDataManager:
Parameters Parameters
---------- ----------
ver_sim: ver_sim: str
{"C5.2"} {"C5.2"}
dir_l1: dir_l1: str
output directory output directory
exposure_id: exposure_id: int
21-154 for C5.2 21-154 for C5.2
Returns Returns
......
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