Commit 2e35e622 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add dm.stamps

parent fa036851
...@@ -13,6 +13,7 @@ Modified-History: ...@@ -13,6 +13,7 @@ Modified-History:
2022-11-06, Bo Zhang, deleted CsstMbiDataManager 2022-11-06, Bo Zhang, deleted CsstMbiDataManager
2022-11-20, Bo Zhang, added DFS APIs 2022-11-20, Bo Zhang, added DFS APIs
""" """
import _io
import glob import glob
import os import os
import re import re
...@@ -20,6 +21,7 @@ from typing import Union ...@@ -20,6 +21,7 @@ from typing import Union
import numpy as np import numpy as np
from astropy.io import fits from astropy.io import fits
from astropy import time
from astropy.table import Table from astropy.table import Table
from csst_dfs_api.facility.level0 import Level0DataApi from csst_dfs_api.facility.level0 import Level0DataApi
from csst_dfs_api.facility.level0prc import Level0PrcApi from csst_dfs_api.facility.level0prc import Level0PrcApi
...@@ -161,7 +163,8 @@ class CsstMsDataManager: ...@@ -161,7 +163,8 @@ class CsstMsDataManager:
verbose=True, verbose=True,
n_jobs=18, n_jobs=18,
backend="multiprocessing", backend="multiprocessing",
device="CPU" device="CPU",
stamps="",
): ):
# set DFS log dir # set DFS log dir
...@@ -253,6 +256,16 @@ class CsstMsDataManager: ...@@ -253,6 +256,16 @@ class CsstMsDataManager:
self.custom_dark = None self.custom_dark = None
self.custom_flat = None self.custom_flat = None
if stamps == "" or stamps is None:
self.stamps = None
else:
self.stamps = open(stamps, "w+")
self.write_stamp()
def write_stamp(self):
if self.stamps is not None:
self.stamps.write(f"{time.Time.now().isot}\n")
# DFS APIs # DFS APIs
@property @property
def dfs_L0DataApi(self): def dfs_L0DataApi(self):
...@@ -321,7 +334,8 @@ class CsstMsDataManager: ...@@ -321,7 +334,8 @@ class CsstMsDataManager:
log_mod="csst-l1mod.log", log_mod="csst-l1mod.log",
n_jobs=18, n_jobs=18,
backend="multiprocessing", backend="multiprocessing",
device="CPU" device="CPU",
**kwargs
): ):
""" initialize the multi-band imaging data manager """ """ initialize the multi-band imaging data manager """
...@@ -367,7 +381,8 @@ class CsstMsDataManager: ...@@ -367,7 +381,8 @@ class CsstMsDataManager:
log_mod=log_mod, log_mod=log_mod,
n_jobs=n_jobs, n_jobs=n_jobs,
backend=backend, backend=backend,
device=device device=device,
**kwargs
) )
@staticmethod @staticmethod
...@@ -780,7 +795,8 @@ class CsstMsDataManager: ...@@ -780,7 +795,8 @@ class CsstMsDataManager:
dfs_root="/share/dfs", dfs_root="/share/dfs",
n_jobs=18, n_jobs=18,
backend="multiprocessing", backend="multiprocessing",
device="CPU" device="CPU",
**kwargs
): ):
""" Initialize CsstMsDataManager from DFS. """ """ Initialize CsstMsDataManager from DFS. """
# (clear and) make directories # (clear and) make directories
...@@ -823,7 +839,8 @@ class CsstMsDataManager: ...@@ -823,7 +839,8 @@ class CsstMsDataManager:
dfs_node=dfs_node, dfs_node=dfs_node,
n_jobs=n_jobs, n_jobs=n_jobs,
backend=backend, backend=backend,
device=device device=device,
**kwargs
) )
assert dm.obs_id == obs_id assert dm.obs_id == obs_id
......
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