Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
csst_common
Commits
27d931af
Commit
27d931af
authored
Nov 21, 2022
by
BO ZHANG
🏀
Browse files
replace attribute with property for DFS APIs
parent
6d4d2d9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
27d931af
...
@@ -18,6 +18,7 @@ import os
...
@@ -18,6 +18,7 @@ import os
import
re
import
re
from
typing
import
Union
from
typing
import
Union
import
joblib
import
numpy
as
np
import
numpy
as
np
from
astropy.io
import
fits
from
astropy.io
import
fits
from
astropy.table
import
Table
from
astropy.table
import
Table
...
@@ -198,12 +199,6 @@ class CsstMsDataManager:
...
@@ -198,12 +199,6 @@ class CsstMsDataManager:
# DFS configuration
# DFS configuration
self
.
use_dfs
=
use_dfs
self
.
use_dfs
=
use_dfs
self
.
dfs_node
=
dfs_node
self
.
dfs_node
=
dfs_node
# DFS APIs
self
.
dfs_L0DataApi
=
Level0DataApi
()
self
.
dfs_L1DataApi
=
Level1DataApi
()
self
.
dfs_L2DataApi
=
Level2DataApi
()
self
.
dfs_L0PrcApi
=
Level0PrcApi
()
self
.
dfs_CalApi
=
CalMergeApi
()
# data directory
# data directory
self
.
dir_l0
=
dir_l0
self
.
dir_l0
=
dir_l0
...
@@ -233,6 +228,27 @@ class CsstMsDataManager:
...
@@ -233,6 +228,27 @@ class CsstMsDataManager:
if
verbose
:
if
verbose
:
self
.
logger_mod
.
info
(
"logger_mod initialized"
)
self
.
logger_mod
.
info
(
"logger_mod initialized"
)
# DFS APIs
@
property
def
dfs_L0DataApi
(
self
):
return
Level0DataApi
()
@
property
def
dfs_L1DataApi
(
self
):
return
Level1DataApi
()
@
property
def
dfs_L2DataApi
(
self
):
return
Level2DataApi
()
@
property
def
dfs_L0PrcApi
(
self
):
return
Level0PrcApi
()
@
property
def
dfs_CalApi
(
self
):
return
CalMergeApi
()
def
set_env
(
self
):
def
set_env
(
self
):
""" set environment variables """
""" set environment variables """
if
os
.
uname
()[
1
]
==
"dandelion"
:
if
os
.
uname
()[
1
]
==
"dandelion"
:
...
@@ -671,3 +687,12 @@ class CsstMsDataManager:
...
@@ -671,3 +687,12 @@ class CsstMsDataManager:
# temporarily compatible with old interface
# temporarily compatible with old interface
CsstMbiDataManager
=
CsstMsDataManager
CsstMbiDataManager
=
CsstMsDataManager
def
test_dm
():
import
joblib
from
csst_common.data_manager
import
CsstMsDataManager
dm
=
CsstMsDataManager
(
dfs_node
=
"pml"
)
def
f
(
dm
,
a
=
1
):
print
(
a
)
joblib
.
Parallel
(
n_jobs
=
10
,)(
joblib
.
delayed
(
f
)(
dm
)
for
i
in
range
(
10
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment