From 1be038fd2208007f32a0cb5f9dbe4a37a1aae891 Mon Sep 17 00:00:00 2001 From: shoulinwei Date: Sat, 3 Dec 2022 22:05:33 +0800 Subject: [PATCH] un level0 --- csst_dfs_api/cpic/__init__.py | 6 +- csst_dfs_api/cpic/level0.py | 80 ---------------- csst_dfs_api/cpic/level0prc.py | 51 ---------- csst_dfs_api/facility/__init__.py | 5 +- csst_dfs_api/{cpic => facility}/calmerge.py | 2 +- csst_dfs_api/{msc => facility}/level0.py | 8 +- csst_dfs_api/{msc => facility}/level0prc.py | 2 +- csst_dfs_api/ifs/__init__.py | 3 - csst_dfs_api/ifs/calmerge.py | 92 ------------------- csst_dfs_api/ifs/level0.py | 79 ---------------- csst_dfs_api/ifs/level0prc.py | 51 ---------- csst_dfs_api/mci/__init__.py | 3 - csst_dfs_api/mci/calmerge.py | 92 ------------------- csst_dfs_api/mci/level0.py | 80 ---------------- csst_dfs_api/mci/level0prc.py | 51 ---------- csst_dfs_api/msc/__init__.py | 3 - csst_dfs_api/msc/calmerge.py | 92 ------------------- csst_dfs_api/sls/__init__.py | 3 - csst_dfs_api/sls/calmerge.py | 92 ------------------- csst_dfs_api/sls/level0.py | 80 ---------------- csst_dfs_api/sls/level0prc.py | 51 ---------- csst_dfs_api/sls/level1.py | 11 +++ tests/common/test_common_catalog.py | 10 +- tests/cpic/test_cpic_cal_merge.py | 48 ---------- tests/cpic/test_cpic_level0.py | 42 --------- tests/cpic/test_cpic_level0_prc.py | 29 ------ tests/cpic/test_cpic_level1.py | 4 +- .../test_facility_cal_merge.py} | 6 +- .../test_facility_level0.py} | 16 ++-- .../test_facility_level0_prc.py} | 6 +- tests/ifs/test_ifs_cal_merge.py | 48 ---------- tests/ifs/test_ifs_level0.py | 33 ------- tests/ifs/test_ifs_level1_prc.py | 2 - tests/mci/test_mci_cal_merge.py | 48 ---------- tests/mci/test_mci_level0.py | 34 ------- tests/mci/test_mci_level0_prc.py | 29 ------ tests/msc/test_msc_level0.py | 42 --------- tests/msc/test_msc_level0_prc.py | 29 ------ tests/msc/test_msc_level1.py | 2 +- tests/msc/test_msc_level2.py | 89 ++++++++++-------- tests/sls/test_sls_cal_merge.py | 48 ---------- tests/sls/test_sls_level0_prc.py | 29 ------ tests/sls/test_sls_level1.py | 4 + 43 files changed, 97 insertions(+), 1438 deletions(-) delete mode 100644 csst_dfs_api/cpic/level0.py delete mode 100644 csst_dfs_api/cpic/level0prc.py rename csst_dfs_api/{cpic => facility}/calmerge.py (97%) rename csst_dfs_api/{msc => facility}/level0.py (91%) rename csst_dfs_api/{msc => facility}/level0prc.py (95%) delete mode 100644 csst_dfs_api/ifs/calmerge.py delete mode 100644 csst_dfs_api/ifs/level0.py delete mode 100644 csst_dfs_api/ifs/level0prc.py delete mode 100644 csst_dfs_api/mci/calmerge.py delete mode 100644 csst_dfs_api/mci/level0.py delete mode 100644 csst_dfs_api/mci/level0prc.py delete mode 100644 csst_dfs_api/msc/calmerge.py delete mode 100644 csst_dfs_api/sls/calmerge.py delete mode 100644 csst_dfs_api/sls/level0.py delete mode 100644 csst_dfs_api/sls/level0prc.py delete mode 100644 tests/cpic/test_cpic_cal_merge.py delete mode 100644 tests/cpic/test_cpic_level0.py delete mode 100644 tests/cpic/test_cpic_level0_prc.py rename tests/{msc/test_msc_cal_merge.py => facility/test_facility_cal_merge.py} (88%) rename tests/{sls/test_sls_level0.py => facility/test_facility_level0.py} (63%) rename tests/{ifs/test_ifs_level0_prc.py => facility/test_facility_level0_prc.py} (79%) delete mode 100644 tests/ifs/test_ifs_cal_merge.py delete mode 100644 tests/ifs/test_ifs_level0.py delete mode 100644 tests/mci/test_mci_cal_merge.py delete mode 100644 tests/mci/test_mci_level0.py delete mode 100644 tests/mci/test_mci_level0_prc.py delete mode 100644 tests/msc/test_msc_level0.py delete mode 100644 tests/msc/test_msc_level0_prc.py delete mode 100644 tests/sls/test_sls_cal_merge.py delete mode 100644 tests/sls/test_sls_level0_prc.py diff --git a/csst_dfs_api/cpic/__init__.py b/csst_dfs_api/cpic/__init__.py index be26374..d4f4fff 100644 --- a/csst_dfs_api/cpic/__init__.py +++ b/csst_dfs_api/cpic/__init__.py @@ -1,4 +1,2 @@ -from .calmerge import CalMergeApi -from .level0 import Level0DataApi -from .level0prc import Level0PrcApi -from .level1 import Level1DataApi \ No newline at end of file +from .level1 import Level1DataApi +from .level1prc import Level1PrcApi \ No newline at end of file diff --git a/csst_dfs_api/cpic/level0.py b/csst_dfs_api/cpic/level0.py deleted file mode 100644 index 65cc3bf..0000000 --- a/csst_dfs_api/cpic/level0.py +++ /dev/null @@ -1,80 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0DataApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "cpic") - self.stub = getattr(self.pymodule, "Level0DataApi")() - - def find(self, **kwargs): - ''' retrieve level0 records from database - - :param kwargs: Parameter dictionary, key items support: - obs_id: [str] - detector_no: [str] - obs_type: [str] - obs_time : (start, end), - qc0_status : [int], - prc_status : [int], - file_name: [str] - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc0_status(self, **kwargs): - ''' update the status of QC0 - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc0_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 data record into database - - :param kwargs: Parameter dictionary, key items support: - obs_id = [str], - detector_no = [str], - obs_type = [str], - obs_time = [str], - exp_time = [int], - detector_status_id = [int], - filename = [str], - file_path = [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/cpic/level0prc.py b/csst_dfs_api/cpic/level0prc.py deleted file mode 100644 index a9f748d..0000000 --- a/csst_dfs_api/cpic/level0prc.py +++ /dev/null @@ -1,51 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0PrcApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "cpic") - self.stub = getattr(self.pymodule, "Level0PrcApi")() - - def find(self, **kwargs): - ''' retrieve level0 procedure records from database - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str] - pipeline_id: [str] - prc_module: [str] - prc_status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 procedure record into database - - :param kwargs: Parameter dictionary, key items support: - level0_id : [str] - pipeline_id : [str] - prc_module : [str] - params_file_path : [str] - prc_status : [int] - prc_time : [str] - result_file_path : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/facility/__init__.py b/csst_dfs_api/facility/__init__.py index c089996..31d0418 100644 --- a/csst_dfs_api/facility/__init__.py +++ b/csst_dfs_api/facility/__init__.py @@ -1,4 +1,7 @@ from .detector import DetectorApi from .brick import BrickApi from .level2producer import Level2ProducerApi -from .observation import ObservationApi \ No newline at end of file +from .observation import ObservationApi +from .calmerge import CalMergeApi +from .level0 import Level0DataApi +from .level0prc import Level0PrcApi \ No newline at end of file diff --git a/csst_dfs_api/cpic/calmerge.py b/csst_dfs_api/facility/calmerge.py similarity index 97% rename from csst_dfs_api/cpic/calmerge.py rename to csst_dfs_api/facility/calmerge.py index d073e75..2669440 100644 --- a/csst_dfs_api/cpic/calmerge.py +++ b/csst_dfs_api/facility/calmerge.py @@ -6,7 +6,7 @@ class CalMergeApi(object): Level 0 Data Operation API """ def __init__(self): - self.pymodule = Delegate().load(sub_module = "cpic") + self.pymodule = Delegate().load(sub_module = "facility") self.stub = getattr(self.pymodule, "CalMergeApi")() def find(self, **kwargs): diff --git a/csst_dfs_api/msc/level0.py b/csst_dfs_api/facility/level0.py similarity index 91% rename from csst_dfs_api/msc/level0.py rename to csst_dfs_api/facility/level0.py index 4f9d289..0ca2cf8 100644 --- a/csst_dfs_api/msc/level0.py +++ b/csst_dfs_api/facility/level0.py @@ -6,7 +6,7 @@ class Level0DataApi(object): Level 0 Data Operation API """ def __init__(self): - self.pymodule = Delegate().load(sub_module = "msc") + self.pymodule = Delegate().load(sub_module = "facility") self.stub = getattr(self.pymodule, "Level0DataApi")() def find(self, **kwargs): @@ -23,7 +23,8 @@ class Level0DataApi(object): ra_obj: [float], dec_obj: [float], radius: [float], - + object_name: [str], + version: [str], limit: limits returns the number of records,default 0:no-limit :returns: csst_dfs_common.models.Result @@ -36,6 +37,7 @@ class Level0DataApi(object): :param kwargs: Parameter dictionary, key items support: id : [int], level0_id: [str] + obs_type: [str] :returns: csst_dfs_common.models.Result ''' @@ -47,6 +49,7 @@ class Level0DataApi(object): :param kwargs: Parameter dictionary, key items support: id : [int], level0_id: [str], + obs_type: [str], status : [int] :returns: csst_dfs_common.models.Result @@ -59,6 +62,7 @@ class Level0DataApi(object): :param kwargs: Parameter dictionary, key items support: id : [int], level0_id: [str], + obs_type: [str], status : [int] :returns: csst_dfs_common.models.Result diff --git a/csst_dfs_api/msc/level0prc.py b/csst_dfs_api/facility/level0prc.py similarity index 95% rename from csst_dfs_api/msc/level0prc.py rename to csst_dfs_api/facility/level0prc.py index 539a49e..428993e 100644 --- a/csst_dfs_api/msc/level0prc.py +++ b/csst_dfs_api/facility/level0prc.py @@ -6,7 +6,7 @@ class Level0PrcApi(object): Level 0 Data Operation API """ def __init__(self): - self.pymodule = Delegate().load(sub_module = "msc") + self.pymodule = Delegate().load(sub_module = "facility") self.stub = getattr(self.pymodule, "Level0PrcApi")() def find(self, **kwargs): diff --git a/csst_dfs_api/ifs/__init__.py b/csst_dfs_api/ifs/__init__.py index 15cff41..d4f4fff 100644 --- a/csst_dfs_api/ifs/__init__.py +++ b/csst_dfs_api/ifs/__init__.py @@ -1,5 +1,2 @@ -from .calmerge import CalMergeApi -from .level0 import Level0DataApi -from .level0prc import Level0PrcApi from .level1 import Level1DataApi from .level1prc import Level1PrcApi \ No newline at end of file diff --git a/csst_dfs_api/ifs/calmerge.py b/csst_dfs_api/ifs/calmerge.py deleted file mode 100644 index 4cddca5..0000000 --- a/csst_dfs_api/ifs/calmerge.py +++ /dev/null @@ -1,92 +0,0 @@ - -from ..common.delegate import Delegate - -class CalMergeApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "ifs") - self.stub = getattr(self.pymodule, "CalMergeApi")() - - def find(self, **kwargs): - ''' retrieve calibration merge records from database - - :param kwargs: Parameter dictionary, key items support: - detector_no: [str], - ref_type: [str], - obs_time: (start,end), - qc1_status : [int], - prc_status : [int], - file_name: [str], - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get_latest_by_l0(self, **kwargs): - ''' retrieve calibration merge records from database by level0 data - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str], - ref_type: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get_latest_by_l0(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc1_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc1_status(**kwargs) - - def write(self, **kwargs): - ''' insert a calibration merge record into database - - :param kwargs: Parameter dictionary, key items support: - cal_id : [str], - detector_no : [str], - ref_type : [str], - obs_time : [str], - exp_time : [float], - prc_status : [int], - prc_time : [str], - filename : [str], - file_path : [str], - level0_ids : [list], - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/ifs/level0.py b/csst_dfs_api/ifs/level0.py deleted file mode 100644 index 62ab4b9..0000000 --- a/csst_dfs_api/ifs/level0.py +++ /dev/null @@ -1,79 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0DataApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "ifs") - self.stub = getattr(self.pymodule, "Level0DataApi")() - - def find(self, **kwargs): - ''' retrieve level0 records from database - - :param kwargs: Parameter dictionary, key items support: - obs_id: [str], - detector_no: [str], - obs_type: [str], - object_name: [str], - obs_time : (start, end), - qc0_status : [int], - prc_status : [int], - file_name: [str], - version: [str], - ra_obj: [float], - dec_obj: [float], - radius: [float], - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc0_status(self, **kwargs): - ''' update the status of QC0 - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc0_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 data record into database - - :param kwargs: Parameter dictionary, key items support: - file_path = [str], - copyfiles = [boolean] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/ifs/level0prc.py b/csst_dfs_api/ifs/level0prc.py deleted file mode 100644 index eb12dba..0000000 --- a/csst_dfs_api/ifs/level0prc.py +++ /dev/null @@ -1,51 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0PrcApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "ifs") - self.stub = getattr(self.pymodule, "Level0PrcApi")() - - def find(self, **kwargs): - ''' retrieve level0 procedure records from database - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str] - pipeline_id: [str] - prc_module: [str] - prc_status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 procedure record into database - - :param kwargs: Parameter dictionary, key items support: - level0_id : [str] - pipeline_id : [str] - prc_module : [str] - params_file_path : [str] - prc_status : [int] - prc_time : [str] - result_file_path : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/mci/__init__.py b/csst_dfs_api/mci/__init__.py index 15cff41..d4f4fff 100644 --- a/csst_dfs_api/mci/__init__.py +++ b/csst_dfs_api/mci/__init__.py @@ -1,5 +1,2 @@ -from .calmerge import CalMergeApi -from .level0 import Level0DataApi -from .level0prc import Level0PrcApi from .level1 import Level1DataApi from .level1prc import Level1PrcApi \ No newline at end of file diff --git a/csst_dfs_api/mci/calmerge.py b/csst_dfs_api/mci/calmerge.py deleted file mode 100644 index 3c94bda..0000000 --- a/csst_dfs_api/mci/calmerge.py +++ /dev/null @@ -1,92 +0,0 @@ - -from ..common.delegate import Delegate - -class CalMergeApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "mci") - self.stub = getattr(self.pymodule, "CalMergeApi")() - - def find(self, **kwargs): - ''' retrieve calibration merge records from database - - :param kwargs: Parameter dictionary, key items support: - detector_no: [str], - ref_type: [str], - obs_time: (start,end), - qc1_status : [int], - prc_status : [int], - file_name: [str], - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get_latest_by_l0(self, **kwargs): - ''' retrieve calibration merge records from database by level0 data - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str], - ref_type: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get_latest_by_l0(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc1_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc1_status(**kwargs) - - def write(self, **kwargs): - ''' insert a calibration merge record into database - - :param kwargs: Parameter dictionary, key items support: - cal_id : [str], - detector_no : [str], - ref_type : [str], - obs_time : [str], - exp_time : [float], - prc_status : [int], - prc_time : [str], - filename : [str], - file_path : [str], - level0_ids : [list], - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/mci/level0.py b/csst_dfs_api/mci/level0.py deleted file mode 100644 index 6ece2bd..0000000 --- a/csst_dfs_api/mci/level0.py +++ /dev/null @@ -1,80 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0DataApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "mci") - self.stub = getattr(self.pymodule, "Level0DataApi")() - - def find(self, **kwargs): - ''' retrieve level0 records from database - - :param kwargs: Parameter dictionary, key items support: - obs_id: [str], - detector_no: [str], - obs_type: [str], - object_name: [str], - obs_time : (start, end), - qc0_status : [int], - prc_status : [int], - file_name: [str], - version: [str], - ra_obj: [float], - dec_obj: [float], - radius: [float], - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc0_status(self, **kwargs): - ''' update the status of QC0 - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc0_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 data record into database - - :param kwargs: Parameter dictionary, key items support: - - file_path = [str], - copyfiles = [boolean] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/mci/level0prc.py b/csst_dfs_api/mci/level0prc.py deleted file mode 100644 index 79125fb..0000000 --- a/csst_dfs_api/mci/level0prc.py +++ /dev/null @@ -1,51 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0PrcApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "mci") - self.stub = getattr(self.pymodule, "Level0PrcApi")() - - def find(self, **kwargs): - ''' retrieve level0 procedure records from database - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str] - pipeline_id: [str] - prc_module: [str] - prc_status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 procedure record into database - - :param kwargs: Parameter dictionary, key items support: - level0_id : [str] - pipeline_id : [str] - prc_module : [str] - params_file_path : [str] - prc_status : [int] - prc_time : [str] - result_file_path : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/msc/__init__.py b/csst_dfs_api/msc/__init__.py index 79badfb..4449958 100644 --- a/csst_dfs_api/msc/__init__.py +++ b/csst_dfs_api/msc/__init__.py @@ -1,6 +1,3 @@ -from .calmerge import CalMergeApi -from .level0 import Level0DataApi -from .level0prc import Level0PrcApi from .level1 import Level1DataApi from .level1prc import Level1PrcApi from .level2 import Level2DataApi \ No newline at end of file diff --git a/csst_dfs_api/msc/calmerge.py b/csst_dfs_api/msc/calmerge.py deleted file mode 100644 index 5a3f1f7..0000000 --- a/csst_dfs_api/msc/calmerge.py +++ /dev/null @@ -1,92 +0,0 @@ - -from ..common.delegate import Delegate - -class CalMergeApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "msc") - self.stub = getattr(self.pymodule, "CalMergeApi")() - - def find(self, **kwargs): - ''' retrieve calibration merge records from database - - :param kwargs: Parameter dictionary, key items support: - detector_no: [str], - ref_type: [str], - obs_time: (start,end), - qc1_status : [int], - prc_status : [int], - file_name: [str], - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get_latest_by_l0(self, **kwargs): - ''' retrieve calibration merge records from database by level0 data - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str], - ref_type: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get_latest_by_l0(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc1_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc1_status(**kwargs) - - def write(self, **kwargs): - ''' insert a calibration merge record into database - - :param kwargs: Parameter dictionary, key items support: - cal_id : [str], - detector_no : [str], - ref_type : [str], - obs_time : [str], - exp_time : [float], - prc_status : [int], - prc_time : [str], - filename : [str], - file_path : [str], - level0_ids : [list], - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/sls/__init__.py b/csst_dfs_api/sls/__init__.py index a9a2615..01dea78 100644 --- a/csst_dfs_api/sls/__init__.py +++ b/csst_dfs_api/sls/__init__.py @@ -1,6 +1,3 @@ -from .calmerge import CalMergeApi -from .level0 import Level0DataApi -from .level0prc import Level0PrcApi from .level1 import Level1DataApi from .level1prc import Level1PrcApi from .level2spectra import Level2SpectraApi \ No newline at end of file diff --git a/csst_dfs_api/sls/calmerge.py b/csst_dfs_api/sls/calmerge.py deleted file mode 100644 index 6e99cf3..0000000 --- a/csst_dfs_api/sls/calmerge.py +++ /dev/null @@ -1,92 +0,0 @@ - -from ..common.delegate import Delegate - -class CalMergeApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "sls") - self.stub = getattr(self.pymodule, "CalMergeApi")() - - def find(self, **kwargs): - ''' retrieve calibration merge records from database - - :param kwargs: Parameter dictionary, key items support: - detector_no: [str], - ref_type: [str], - obs_time: (start,end), - qc1_status : [int], - prc_status : [int], - file_name: [str], - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get_latest_by_l0(self, **kwargs): - ''' retrieve calibration merge records from database by level0 data - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str], - ref_type: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get_latest_by_l0(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc1_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - cal_id : [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc1_status(**kwargs) - - def write(self, **kwargs): - ''' insert a calibration merge record into database - - :param kwargs: Parameter dictionary, key items support: - cal_id : [str], - detector_no : [str], - ref_type : [str], - obs_time : [str], - exp_time : [float], - prc_status : [int], - prc_time : [str], - filename : [str], - file_path : [str], - level0_ids : [list], - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/sls/level0.py b/csst_dfs_api/sls/level0.py deleted file mode 100644 index 909fbb5..0000000 --- a/csst_dfs_api/sls/level0.py +++ /dev/null @@ -1,80 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0DataApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "sls") - self.stub = getattr(self.pymodule, "Level0DataApi")() - - def find(self, **kwargs): - ''' retrieve level0 records from database - - :param kwargs: Parameter dictionary, key items support: - obs_id: [str] - detector_no: [str] - obs_type: [str] - obs_time : (start, end), - qc0_status : [int], - prc_status : [int], - file_name: [str] - limit: limits returns the number of records,default 0:no-limit - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def get(self, **kwargs): - ''' fetch a record from database - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.get(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def update_qc0_status(self, **kwargs): - ''' update the status of QC0 - - :param kwargs: Parameter dictionary, key items support: - id : [int], - level0_id: [str], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_qc0_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 data record into database - - :param kwargs: Parameter dictionary, key items support: - obs_id = [str], - detector_no = [str], - obs_type = [str], - obs_time = [str], - exp_time = [int], - detector_status_id = [int], - filename = [str], - file_path = [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/sls/level0prc.py b/csst_dfs_api/sls/level0prc.py deleted file mode 100644 index 344a99e..0000000 --- a/csst_dfs_api/sls/level0prc.py +++ /dev/null @@ -1,51 +0,0 @@ - -from ..common.delegate import Delegate - -class Level0PrcApi(object): - """ - Level 0 Data Operation API - """ - def __init__(self): - self.pymodule = Delegate().load(sub_module = "sls") - self.stub = getattr(self.pymodule, "Level0PrcApi")() - - def find(self, **kwargs): - ''' retrieve level0 procedure records from database - - :param kwargs: Parameter dictionary, key items support: - level0_id: [str] - pipeline_id: [str] - prc_module: [str] - prc_status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.find(**kwargs) - - def update_proc_status(self, **kwargs): - ''' update the status of reduction - - :param kwargs: Parameter dictionary, key items support: - id : [int], - status : [int] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.update_proc_status(**kwargs) - - def write(self, **kwargs): - ''' insert a level0 procedure record into database - - :param kwargs: Parameter dictionary, key items support: - level0_id : [str] - pipeline_id : [str] - prc_module : [str] - params_file_path : [str] - prc_status : [int] - prc_time : [str] - result_file_path : [str] - - :returns: csst_dfs_common.models.Result - ''' - return self.stub.write(**kwargs) - diff --git a/csst_dfs_api/sls/level1.py b/csst_dfs_api/sls/level1.py index 272de63..6105840 100644 --- a/csst_dfs_api/sls/level1.py +++ b/csst_dfs_api/sls/level1.py @@ -25,6 +25,17 @@ class Level1DataApi(object): ''' return self.stub.find(**kwargs) + def find_by_prc_status(self, **kwargs): + ''' retrieve level1 records from database + + :param kwargs: Parameter dictionary, key items support: + prc_status : [int], + limit: limits returns the number of records,default 0:no-limit + + :returns: csst_dfs_common.models.Result + ''' + return self.stub.find_by_prc_status(**kwargs) + def get(self, **kwargs): ''' fetch a record from database diff --git a/tests/common/test_common_catalog.py b/tests/common/test_common_catalog.py index 72f20d4..2859250 100644 --- a/tests/common/test_common_catalog.py +++ b/tests/common/test_common_catalog.py @@ -13,18 +13,18 @@ class CommonCatalogTestCase(unittest.TestCase): def test_catalog_query(self): t= time.time() result = self.api.catalog_query( - ra=193, # 15415 - dec=26, - radius=0.1, + ra=193.299, + dec=19.08851, + radius=2, catalog_name='gaia3', min_mag=-1, max_mag=-1, obstime = -1, - limit = 1 + limit = 0 ) print(result) # dt = self.api.to_table(result) # df = dt.to_pandas() # print(df.head()) print('used:', time.time()-t) - print('return:', result['totalCount']) + # print('return:', result['totalCount'\]) diff --git a/tests/cpic/test_cpic_cal_merge.py b/tests/cpic/test_cpic_cal_merge.py deleted file mode 100644 index b11865b..0000000 --- a/tests/cpic/test_cpic_cal_merge.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.cpic.calmerge import CalMergeApi - -class SLSCalMergeApiTestCase(unittest.TestCase): - - def setUp(self): - self.api = CalMergeApi() - - def test_find(self): - recs = self.api.find(detector_no='CCD01', - ref_type = "bias", - obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) - print('find:', recs) - - def test_get_latest_by_l0(self): - rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias") - print('get_latest_by_l0:', rec) - - def test_get(self): - rec = self.api.get(id = 2) - print('get by id:', rec) - rec = self.api.get(cal_id = '2') - print('get by cal_id:', rec) - - # def test_update_proc_status(self): - # rec = self.api.update_proc_status(id = 3, status = 1) - # print('update_proc_status:', rec) - - # def test_update_qc1_status(self): - # rec = self.api.update_qc1_status(id = 3, status = 2) - # print('update_qc1_status:', rec) - - # def test_write(self): - # rec = self.api.write( - # cal_id = '00002', - # detector_no = '01', - # ref_type = "bias", - # obs_time = "2021-06-04 11:12:13", - # exp_time = 150, - # filename = "/opt/dddasd1.params", - # file_path = "/opt/dddasd1.fits", - # prc_status = 3, - # prc_time = '2021-06-04 11:12:13', - # level0_ids = ['1','2','3','4']) - # print('write:', rec) \ No newline at end of file diff --git a/tests/cpic/test_cpic_level0.py b/tests/cpic/test_cpic_level0.py deleted file mode 100644 index e9bc6a9..0000000 --- a/tests/cpic/test_cpic_level0.py +++ /dev/null @@ -1,42 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.cpic.level0 import Level0DataApi - -class CPICLevel0DataTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0DataApi() - - def test_find(self): - recs = self.api.find(obs_id = '000009', obs_type = 'sci', limit = 0) - print('find:', recs) - - def test_get(self): - rec = self.api.get(id = 100) - print('get:', rec) - - rec = self.api.get(level0_id = '1000000102') - print('get:', rec) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(level0_id = '000001102', status = 6) - print('update_proc_status:', rec) - - def test_update_qc0_status(self): - rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) - print('update_qc0_status:', rec) - - def test_write(self): - rec = self.api.write( - level0_id = '000001101', - obs_id = '0000011', - detector_no = "01", - obs_type = "sci", - obs_time = "2021-06-06 11:12:13", - exp_time = 150, - detector_status_id = 3, - filename = "MSC_00001234", - file_path = "/opt/MSC_00001234.fits") - print('write:', rec) \ No newline at end of file diff --git a/tests/cpic/test_cpic_level0_prc.py b/tests/cpic/test_cpic_level0_prc.py deleted file mode 100644 index 523fb72..0000000 --- a/tests/cpic/test_cpic_level0_prc.py +++ /dev/null @@ -1,29 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.cpic.level0prc import Level0PrcApi - -class CPICLevel0PrcTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0PrcApi() - - def test_find(self): - recs = self.api.find(level0_id='134') - print('find:', recs) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(id = 8, status = 4) - print('update_proc_status:', rec) - - def test_write(self): - rec = self.api.write( - level0_id='134', - pipeline_id = "P1", - prc_module = "QC0", - params_file_path = "/opt/dddasd.params", - prc_status = 3, - prc_time = '2021-06-04 11:12:13', - result_file_path = "/opt/dddasd.header") - print('write:', rec) \ No newline at end of file diff --git a/tests/cpic/test_cpic_level1.py b/tests/cpic/test_cpic_level1.py index 7764954..515778e 100644 --- a/tests/cpic/test_cpic_level1.py +++ b/tests/cpic/test_cpic_level1.py @@ -2,7 +2,7 @@ import unittest from csst_dfs_api.cpic import Level1DataApi -class CPICResult1TestCase(unittest.TestCase): +class CPICLevel1TestCase(unittest.TestCase): def setUp(self): self.api = Level1DataApi() @@ -28,7 +28,7 @@ class CPICResult1TestCase(unittest.TestCase): def test_write(self): rec = self.api.write( - level0_id='0000223', + level0_id='400001223', data_type = "sci", prc_params = "/opt/dddasd.params", prc_status = 3, diff --git a/tests/msc/test_msc_cal_merge.py b/tests/facility/test_facility_cal_merge.py similarity index 88% rename from tests/msc/test_msc_cal_merge.py rename to tests/facility/test_facility_cal_merge.py index 2037ce9..2cbfb50 100644 --- a/tests/msc/test_msc_cal_merge.py +++ b/tests/facility/test_facility_cal_merge.py @@ -1,8 +1,6 @@ -import os import unittest -from astropy.io import fits -from csst_dfs_api.msc.calmerge import CalMergeApi +from csst_dfs_api.facility.calmerge import CalMergeApi class MSCCalMergeApiTestCase(unittest.TestCase): @@ -10,7 +8,7 @@ class MSCCalMergeApiTestCase(unittest.TestCase): self.api = CalMergeApi() def test_find(self): - recs = self.api.find(detector_no='CCD01', + recs = self.api.find(detector_no='01', ref_type = "bias", obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) print('find:', recs) diff --git a/tests/sls/test_sls_level0.py b/tests/facility/test_facility_level0.py similarity index 63% rename from tests/sls/test_sls_level0.py rename to tests/facility/test_facility_level0.py index de813ed..456f187 100644 --- a/tests/sls/test_sls_level0.py +++ b/tests/facility/test_facility_level0.py @@ -1,31 +1,29 @@ -import os import unittest -from astropy.io import fits -from csst_dfs_api.sls.level0 import Level0DataApi +from csst_dfs_api.facility.level0 import Level0DataApi -class SLSLevel0DataTestCase(unittest.TestCase): +class Level0DataTestCase(unittest.TestCase): def setUp(self): self.api = Level0DataApi() def test_find(self): - recs = self.api.find(obs_id = '000009', obs_type = 'sci', limit = 0) + recs = self.api.find(obs_id = '0000011', obs_type = 'sci', limit = 0) print('find:', recs) def test_get(self): - rec = self.api.get(id = 100) + rec = self.api.get(id = 3) print('get:', rec) - rec = self.api.get(level0_id = '1000000102') + rec = self.api.get(level0_id = '000001101',obs_type='sci') print('get:', rec) def test_update_proc_status(self): - rec = self.api.update_proc_status(level0_id = '000001102', status = 6) + rec = self.api.update_proc_status(level0_id = '000001101', status = 6) print('update_proc_status:', rec) def test_update_qc0_status(self): - rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) + rec = self.api.update_qc0_status(level0_id = '000001101', status = 7) print('update_qc0_status:', rec) def test_write(self): diff --git a/tests/ifs/test_ifs_level0_prc.py b/tests/facility/test_facility_level0_prc.py similarity index 79% rename from tests/ifs/test_ifs_level0_prc.py rename to tests/facility/test_facility_level0_prc.py index e03be2e..a38e413 100644 --- a/tests/ifs/test_ifs_level0_prc.py +++ b/tests/facility/test_facility_level0_prc.py @@ -1,10 +1,8 @@ -import os import unittest -from astropy.io import fits -from csst_dfs_api.ifs.level0prc import Level0PrcApi +from csst_dfs_api.facility.level0prc import Level0PrcApi -class IFSLevel0PrcTestCase(unittest.TestCase): +class Level0PrcTestCase(unittest.TestCase): def setUp(self): self.api = Level0PrcApi() diff --git a/tests/ifs/test_ifs_cal_merge.py b/tests/ifs/test_ifs_cal_merge.py deleted file mode 100644 index d8884bd..0000000 --- a/tests/ifs/test_ifs_cal_merge.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.ifs.calmerge import CalMergeApi - -class IFSCalMergeApiTestCase(unittest.TestCase): - - def setUp(self): - self.api = CalMergeApi() - - def test_find(self): - recs = self.api.find(detector_no='CCD01', - ref_type = "bias", - obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) - print('find:', recs) - - def test_get_latest_by_l0(self): - rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias") - print('get_latest_by_l0:', rec) - - def test_get(self): - rec = self.api.get(id = 2) - print('get by id:', rec) - rec = self.api.get(cal_id = '2') - print('get by cal_id:', rec) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(id = 3, status = 1) - print('update_proc_status:', rec) - - def test_update_qc1_status(self): - rec = self.api.update_qc1_status(id = 3, status = 2) - print('update_qc1_status:', rec) - - def test_write(self): - rec = self.api.write( - cal_id = '00002', - detector_no = '01', - ref_type = "bias", - obs_time = "2021-06-04 11:12:13", - exp_time = 150, - filename = "/opt/dddasd1.params", - file_path = "/opt/dddasd1.fits", - prc_status = 3, - prc_time = '2021-06-04 11:12:13', - level0_ids = ['1','2','3','4']) - print('write:', rec) \ No newline at end of file diff --git a/tests/ifs/test_ifs_level0.py b/tests/ifs/test_ifs_level0.py deleted file mode 100644 index 6f0485c..0000000 --- a/tests/ifs/test_ifs_level0.py +++ /dev/null @@ -1,33 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.ifs.level0 import Level0DataApi - -class IFSLevel0DataTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0DataApi() - - # def test_find(self): - # result = self.api.find(ra = 248, dec = 87, radius = 2, limit = 0, obs_type = "sky") - # print('find:', result) - - # def test_get(self): - # result = self.api.get(id = 1) - # print('get:', result.data) - - # rec = self.api.get(level0_id = '300000145CCD231-c4') - # print('get:', rec) - - # def test_update_proc_status(self): - # rec = self.api.update_proc_status(level0_id = '000001102', status = 6) - # print('update_proc_status:', rec) - - # def test_update_qc0_status(self): - # rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) - # print('update_qc0_status:', rec) - - def test_write(self): - rec = self.api.write(file_path = "/Users/wsl/temp/csst/ifs_data/sky_Data/CSST_IFS_B_sky_20211225001425_20211225001925_300000013_X_L0_VER_I4203.fits") - print('write:', rec) \ No newline at end of file diff --git a/tests/ifs/test_ifs_level1_prc.py b/tests/ifs/test_ifs_level1_prc.py index 84eaa1e..39ffa10 100644 --- a/tests/ifs/test_ifs_level1_prc.py +++ b/tests/ifs/test_ifs_level1_prc.py @@ -1,6 +1,4 @@ -import os import unittest -from astropy.io import fits from csst_dfs_api.ifs.level1prc import Level1PrcApi diff --git a/tests/mci/test_mci_cal_merge.py b/tests/mci/test_mci_cal_merge.py deleted file mode 100644 index a469bcd..0000000 --- a/tests/mci/test_mci_cal_merge.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.mci.calmerge import CalMergeApi - -class MCICalMergeApiTestCase(unittest.TestCase): - - def setUp(self): - self.api = CalMergeApi() - - def test_find(self): - recs = self.api.find(detector_no='CCD01', - ref_type = "bias", - obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) - print('find:', recs) - - def test_get_latest_by_l0(self): - rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias") - print('get_latest_by_l0:', rec) - - def test_get(self): - rec = self.api.get(id = 2) - print('get by id:', rec) - rec = self.api.get(cal_id = '2') - print('get by cal_id:', rec) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(id = 3, status = 1) - print('update_proc_status:', rec) - - def test_update_qc1_status(self): - rec = self.api.update_qc1_status(id = 3, status = 2) - print('update_qc1_status:', rec) - - def test_write(self): - rec = self.api.write( - cal_id = '00002', - detector_no = '01', - ref_type = "bias", - obs_time = "2021-06-04 11:12:13", - exp_time = 150, - filename = "/opt/dddasd1.params", - file_path = "/opt/dddasd1.fits", - prc_status = 3, - prc_time = '2021-06-04 11:12:13', - level0_ids = ['1','2','3','4']) - print('write:', rec) \ No newline at end of file diff --git a/tests/mci/test_mci_level0.py b/tests/mci/test_mci_level0.py deleted file mode 100644 index 8954af0..0000000 --- a/tests/mci/test_mci_level0.py +++ /dev/null @@ -1,34 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.mci.level0 import Level0DataApi - -class MCILevel0DataTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0DataApi() - - def test_find(self): - recs = self.api.find(limit = 0) - print('find:', recs) - - def test_get(self): - rec = self.api.get(id = 1) - print('get:', rec) - - rec = self.api.get(level0_id = '200000006-') - print('get:', rec) - - # def test_update_proc_status(self): - # rec = self.api.update_proc_status(level0_id = '000001102', status = 6) - # print('update_proc_status:', rec) - - # def test_update_qc0_status(self): - # rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) - # print('update_qc0_status:', rec) - - # def test_write(self): - # rec = self.api.write( - # file_path = "/opt/MSC_00001234.fits") - # print('write:', rec) \ No newline at end of file diff --git a/tests/mci/test_mci_level0_prc.py b/tests/mci/test_mci_level0_prc.py deleted file mode 100644 index a450cd3..0000000 --- a/tests/mci/test_mci_level0_prc.py +++ /dev/null @@ -1,29 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.mci.level0prc import Level0PrcApi - -class MCILevel0PrcTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0PrcApi() - - def test_find(self): - recs = self.api.find(level0_id='134') - print('find:', recs) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(id = 8, status = 4) - print('update_proc_status:', rec) - - def test_write(self): - rec = self.api.write( - level0_id='134', - pipeline_id = "P1", - prc_module = "QC0", - params_file_path = "/opt/dddasd.params", - prc_status = 3, - prc_time = '2021-06-04 11:12:13', - result_file_path = "/opt/dddasd.header") - print('write:', rec) \ No newline at end of file diff --git a/tests/msc/test_msc_level0.py b/tests/msc/test_msc_level0.py deleted file mode 100644 index a19998c..0000000 --- a/tests/msc/test_msc_level0.py +++ /dev/null @@ -1,42 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.msc.level0 import Level0DataApi - -class MSCLevel0DataTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0DataApi() - - def test_find(self): - recs = self.api.find(obs_id = '100000154', obs_type = 'sci', limit = 0) - print('find:', recs) - - def test_get(self): - rec = self.api.get(id = 2) - print('get:', rec) - - rec = self.api.get(level0_id = '10000000123') - print('get:', rec) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(level0_id = '000001102', status = 6) - print('update_proc_status:', rec) - - def test_update_qc0_status(self): - rec = self.api.update_qc0_status(level0_id = '000001102', status = 7) - print('update_qc0_status:', rec) - - def test_write(self): - rec = self.api.write( - level0_id = '000001101', - obs_id = '0000011', - detector_no = "01", - obs_type = "sci", - obs_time = "2021-06-06 11:12:13", - exp_time = 150, - detector_status_id = 3, - filename = "MSC_00001234", - file_path = "/opt/MSC_00001234.fits") - print('write:', rec) \ No newline at end of file diff --git a/tests/msc/test_msc_level0_prc.py b/tests/msc/test_msc_level0_prc.py deleted file mode 100644 index ae663cb..0000000 --- a/tests/msc/test_msc_level0_prc.py +++ /dev/null @@ -1,29 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.msc.level0prc import Level0PrcApi - -class MSCLevel0PrcTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0PrcApi() - - def test_find(self): - recs = self.api.find(level0_id='134') - print('find:', recs) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(id = 8, status = 4) - print('update_proc_status:', rec) - - def test_write(self): - rec = self.api.write( - level0_id='134', - pipeline_id = "P1", - prc_module = "QC0", - params_file_path = "/opt/dddasd.params", - prc_status = 3, - prc_time = '2021-06-04 11:12:13', - result_file_path = "/opt/dddasd.header") - print('write:', rec) \ No newline at end of file diff --git a/tests/msc/test_msc_level1.py b/tests/msc/test_msc_level1.py index 371c2d8..5f60366 100644 --- a/tests/msc/test_msc_level1.py +++ b/tests/msc/test_msc_level1.py @@ -36,7 +36,7 @@ class MSCLevel1DataTestCase(unittest.TestCase): prc_status = 3, prc_time = '2021-10-22 11:12:13', filename = "MSC_MS_210525121500_100000001_09_raw", - file_path = "/opt/temp/csst/MSC_MS_210525121500_100000001_09_raw.fits", + file_path = "/opt/temp/csst/msc/level1/MSC_210304093000_0000000_06_img.fits.fz", pipeline_id = "P1", refs = {'dark': 1, 'bias': 2, 'flat': 3 }) print('write:', rec) \ No newline at end of file diff --git a/tests/msc/test_msc_level2.py b/tests/msc/test_msc_level2.py index 98f8413..8cbd51e 100644 --- a/tests/msc/test_msc_level2.py +++ b/tests/msc/test_msc_level2.py @@ -1,7 +1,7 @@ import os import unittest from astropy.io import fits - +from csst_dfs_api.common.utils import to_table as to_fits_table from csst_dfs_api.msc.level2 import Level2DataApi class MSCLevel2DataTestCase(unittest.TestCase): @@ -9,42 +9,51 @@ class MSCLevel2DataTestCase(unittest.TestCase): def setUp(self): self.api = Level2DataApi() - def test_find(self): - recs = self.api.find( - level1_id=1, - create_time = ("2022-06-15 11:12:13","2022-06-16 11:12:13")) - print('find:', recs) - - def test_catalog_query(self): - result = self.api.catalog_query( - obs_id='100000000', - obs_time = ("2021-05-24 11:12:13","2021-05-25 13:12:13"), - limit = 2) - if result.success: - dt = self.api.to_table(result) - dt.pprint() - else: - print(result) - - def test_get(self): - rec = self.api.get(id = 1) - print('get:', rec) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(id = 1, status = 4) - print('update_proc_status:', rec) - - def test_update_qc2_status(self): - rec = self.api.update_qc2_status(id = 1, status = 7) - print('update_qc2_status:', rec) - - def test_write(self): - rec = self.api.write( - level1_id= 1, - data_type = "sci", - prc_status = 3, - prc_time = '2021-10-22 11:12:13', - filename = "MSC_MS_210525120000_100000000_20_cat.fits", - file_path = "/opt/temp/csst/msc_data/MSC_MS_210525120000_100000000_20_cat.fits" - ) - print('write:', rec) + # def test_find(self): + # recs = self.api.find( + # level1_id=1, + # create_time = ("2022-06-15 11:12:13","2022-06-16 11:12:13")) + # print('find:', recs) + + # def test_catalog_query(self): + # result = self.api.catalog_query( + # obs_id = '100000133', + # detector_no = '13', + # ra = 192, + # dec = 26, + # radius = 1, + # limit = 2) + # print(result) + # if result.success and result['totalCount'] > 0: + # dt = to_fits_table(result) + # dt.pprint() + + def test_catalog_query_file(self): + result = self.api.catalog_query_file( + ra = 192, + dec = 26, + radius = 1) + print(result) + + # def test_get(self): + # rec = self.api.get(id = 1) + # print('get:', rec) + + # def test_update_proc_status(self): + # rec = self.api.update_proc_status(id = 1, status = 4) + # print('update_proc_status:', rec) + + # def test_update_qc2_status(self): + # rec = self.api.update_qc2_status(id = 1, status = 7) + # print('update_qc2_status:', rec) + + # def test_write(self): + # rec = self.api.write( + # level1_id= 1, + # data_type = "sci", + # prc_status = 3, + # prc_time = '2021-10-22 11:12:13', + # filename = "MSC_MS_210525120000_100000000_20_cat.fits", + # file_path = "/opt/temp/csst/msc_data/MSC_MS_210525120000_100000000_20_cat.fits" + # ) + # print('write:', rec) diff --git a/tests/sls/test_sls_cal_merge.py b/tests/sls/test_sls_cal_merge.py deleted file mode 100644 index 838406d..0000000 --- a/tests/sls/test_sls_cal_merge.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.sls.calmerge import CalMergeApi - -class SLSCalMergeApiTestCase(unittest.TestCase): - - def setUp(self): - self.api = CalMergeApi() - - # def test_find(self): - # recs = self.api.find(detector_no='CCD01', - # ref_type = "bias", - # obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) - # print('find:', recs) - - # def test_get_latest_by_l0(self): - # rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias") - # print('get_latest_by_l0:', rec) - - def test_get(self): - rec = self.api.get(id = 2) - print('get by id:', rec) - rec = self.api.get(cal_id = '2') - print('get by cal_id:', rec) - - # def test_update_proc_status(self): - # rec = self.api.update_proc_status(id = 3, status = 1) - # print('update_proc_status:', rec) - - # def test_update_qc1_status(self): - # rec = self.api.update_qc1_status(id = 3, status = 2) - # print('update_qc1_status:', rec) - - # def test_write(self): - # rec = self.api.write( - # cal_id = '00002', - # detector_no = '01', - # ref_type = "bias", - # obs_time = "2021-06-04 11:12:13", - # exp_time = 150, - # filename = "/opt/dddasd1.params", - # file_path = "/opt/dddasd1.fits", - # prc_status = 3, - # prc_time = '2021-06-04 11:12:13', - # level0_ids = ['1','2','3','4']) - # print('write:', rec) \ No newline at end of file diff --git a/tests/sls/test_sls_level0_prc.py b/tests/sls/test_sls_level0_prc.py deleted file mode 100644 index 35f6622..0000000 --- a/tests/sls/test_sls_level0_prc.py +++ /dev/null @@ -1,29 +0,0 @@ -import os -import unittest -from astropy.io import fits - -from csst_dfs_api.sls.level0prc import Level0PrcApi - -class SLSLevel0PrcTestCase(unittest.TestCase): - - def setUp(self): - self.api = Level0PrcApi() - - def test_find(self): - recs = self.api.find(level0_id='134') - print('find:', recs) - - def test_update_proc_status(self): - rec = self.api.update_proc_status(id = 8, status = 4) - print('update_proc_status:', rec) - - def test_write(self): - rec = self.api.write( - level0_id='134', - pipeline_id = "P1", - prc_module = "QC0", - params_file_path = "/opt/dddasd.params", - prc_status = 3, - prc_time = '2021-06-04 11:12:13', - result_file_path = "/opt/dddasd.header") - print('write:', rec) \ No newline at end of file diff --git a/tests/sls/test_sls_level1.py b/tests/sls/test_sls_level1.py index 1cb32b1..6c207d7 100644 --- a/tests/sls/test_sls_level1.py +++ b/tests/sls/test_sls_level1.py @@ -14,6 +14,10 @@ class SLSResult1TestCase(unittest.TestCase): ) print('find:', recs) + def test_find_by_prc_status(self): + recs = self.api.find_by_prc_status() + print('test_find_by_prc_status:', recs) + def test_get(self): rec = self.api.get(id = 1) print('get:', rec) -- GitLab