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-dfs
csst-dfs-api
Commits
a1e6ad7b
Commit
a1e6ad7b
authored
Feb 14, 2023
by
Wei Shoulin
Browse files
rm module level1
parent
4cd9a653
Changes
32
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api/cpic/__init__.py
View file @
a1e6ad7b
from
.level1
import
Level1DataApi
from
.level1prc
import
Level1PrcApi
\ No newline at end of file
csst_dfs_api/cpic/level1.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1DataApi
(
object
):
"""
Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"cpic"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1DataApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 records from database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
data_type: [str]
create_time : (start, end),
qc1_status : [int],
prc_status : [int],
filename: [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]
: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],
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 QC0
:param kwargs: Parameter dictionary, key items support:
id = [int],
status = [int]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
update_qc1_status
(
**
kwargs
)
def
write
(
self
,
**
kwargs
):
''' insert a level1 record into database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
data_type : [str]
cor_sci_id : [int]
prc_params : [str]
filename : [str]
file_path : [str]
prc_status : [int]
prc_time : [str]
pipeline_id : [str]
refs: [dict]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
write
(
**
kwargs
)
csst_dfs_api/cpic/level1prc.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1PrcApi
(
object
):
"""
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"cpic"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1PrcApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 procedure records from database
:param kwargs: Parameter dictionary, key items support:
level1_id: [int]
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 level1 procedure record into database
:param kwargs: Parameter dictionary, key items support:
level1_id : [int]
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
)
csst_dfs_api/facility/__init__.py
View file @
a1e6ad7b
...
...
@@ -2,6 +2,7 @@ from .detector import DetectorApi
from
.brick
import
BrickApi
from
.level2producer
import
Level2ProducerApi
from
.observation
import
ObservationApi
from
.calmerge
import
CalMergeApi
from
.level0
import
Level0DataApi
from
.level0prc
import
Level0PrcApi
\ No newline at end of file
from
.level0prc
import
Level0PrcApi
from
.level1
import
Level1DataApi
from
.level1prc
import
Level1PrcApi
\ No newline at end of file
csst_dfs_api/facility/calmerge.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
CalMergeApi
(
object
):
"""
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"facility"
)
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
)
csst_dfs_api/facility/level0.py
View file @
a1e6ad7b
...
...
@@ -14,6 +14,7 @@ class Level0DataApi(object):
:param kwargs: Parameter dictionary, key items support:
obs_id: [str],
module_id: [str]
detector_no: [str],
obs_type: [str],
filter: [str],
...
...
csst_dfs_api/
mbi
/level1.py
→
csst_dfs_api/
facility
/level1.py
View file @
a1e6ad7b
...
...
@@ -6,7 +6,7 @@ class Level1DataApi(object):
Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"
mbi
"
)
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"
facility
"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1DataApi"
)()
def
find
(
self
,
**
kwargs
):
...
...
@@ -14,6 +14,7 @@ class Level1DataApi(object):
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
module_id: [str]
data_type: [str]
create_time : (start, end),
qc1_status : [int],
...
...
csst_dfs_api/
mci
/level1prc.py
→
csst_dfs_api/
facility
/level1prc.py
View file @
a1e6ad7b
...
...
@@ -6,7 +6,7 @@ class Level1PrcApi(object):
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"
mci
"
)
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"
facility
"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1PrcApi"
)()
def
find
(
self
,
**
kwargs
):
...
...
csst_dfs_api/functional/__init__.py
0 → 100644
View file @
a1e6ad7b
from
..facility
import
ObservationApi
,
Level0DataApi
from
csst_dfs_commons.models
import
Result
def
find_observation
(
module_id
:
str
=
None
,
obs_type
:
str
=
None
,
obs_time
:
tuple
=
(
None
,
None
),
qc0_status
:
int
=
-
1
,
prc_status
:
int
=
-
1
)
->
Result
:
return
ObservationApi
().
find
()
def
find_level0
(
obs_id
:
str
=
''
,
module_id
:
str
=
''
,
detector_no
:
str
=
''
,
obs_type
:
str
=
''
,
filter
:
str
=
''
,
obs_time
:
tuple
=
(
None
,
None
),
qc0_status
:
int
=
-
1
,
prc_status
:
int
=
-
1
,
file_name
:
str
=
''
,
ra_obj
:
float
=
None
,
dec_obj
:
float
=
None
,
radius
:
float
=
None
,
object_name
:
str
=
None
,
version
:
str
=
None
)
->
Result
:
return
Level0DataApi
().
find
()
csst_dfs_api/hstdm/__init__.py
View file @
a1e6ad7b
from
.level1
import
Level1DataApi
from
.level1prc
import
Level1PrcApi
\ No newline at end of file
csst_dfs_api/hstdm/level1.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1DataApi
(
object
):
"""
IFS Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"hstdm"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1DataApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 records from database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str],
data_type: [str],
create_time : (start, end),
qc1_status : [int],
prc_status : [int],
filename: [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]
: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],
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 QC1
:param kwargs: Parameter dictionary, key items support:
id = [int],
status = [int]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
update_qc1_status
(
**
kwargs
)
def
write
(
self
,
**
kwargs
):
''' insert a level1 record into database
:param kwargs: Parameter dictionary, key items support:
level0_id : [str]
data_type : [str]
cor_sci_id : [int]
prc_params : [str]
filename : [str]
file_path : [str]
prc_status : [int]
prc_time : [str]
pipeline_id : [str]
refs: [dict]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
write
(
**
kwargs
)
csst_dfs_api/hstdm/level1prc.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1PrcApi
(
object
):
"""
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"mci"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1PrcApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 procedure records from database
:param kwargs: Parameter dictionary, key items support:
level1_id: [int]
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 level1 procedure record into database
:param kwargs: Parameter dictionary, key items support:
level1_id : [int]
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
)
csst_dfs_api/mbi/__init__.py
View file @
a1e6ad7b
from
.level1
import
Level1DataApi
from
.level1prc
import
Level1PrcApi
from
.level2
import
Level2DataApi
from
.level2co
import
Level2CoApi
\ No newline at end of file
csst_dfs_api/mbi/level1prc.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1PrcApi
(
object
):
"""
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"mbi"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1PrcApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 procedure records from database
:param kwargs: Parameter dictionary, key items support:
level1_id: [int]
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 level1 procedure record into database
:param kwargs: Parameter dictionary, key items support:
level1_id : [int]
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
)
csst_dfs_api/mci/__init__.py
View file @
a1e6ad7b
from
.level1
import
Level1DataApi
from
.level1prc
import
Level1PrcApi
\ No newline at end of file
csst_dfs_api/mci/level1.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1DataApi
(
object
):
"""
IFS Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"mci"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1DataApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 records from database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str],
data_type: [str],
create_time : (start, end),
qc1_status : [int],
prc_status : [int],
filename: [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]
: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],
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 QC1
:param kwargs: Parameter dictionary, key items support:
id = [int],
status = [int]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
update_qc1_status
(
**
kwargs
)
def
write
(
self
,
**
kwargs
):
''' insert a level1 record into database
:param kwargs: Parameter dictionary, key items support:
level0_id : [str]
data_type : [str]
cor_sci_id : [int]
prc_params : [str]
filename : [str]
file_path : [str]
prc_status : [int]
prc_time : [str]
pipeline_id : [str]
refs: [dict]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
write
(
**
kwargs
)
csst_dfs_api/sls/__init__.py
View file @
a1e6ad7b
from
.level1
import
Level1DataApi
from
.level1prc
import
Level1PrcApi
from
.level2spectra
import
Level2SpectraApi
\ No newline at end of file
csst_dfs_api/sls/level1.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1DataApi
(
object
):
"""
Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"sls"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1DataApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 records from database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
data_type: [str]
create_time : (start, end),
qc1_status : [int],
prc_status : [int],
filename: [str]
limit: limits returns the number of records,default 0:no-limit
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
find
(
**
kwargs
)
def
find_by_brick_ids
(
self
,
**
kwargs
):
''' retrieve level1 records by brick_ids like [1,2,3,4]
:param kwargs: Parameter dictionary, key items support:
brick_ids: [list]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
find_by_brick_ids
(
**
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
:param kwargs: Parameter dictionary, key items support:
id : [int]
: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],
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 QC1
:param kwargs: Parameter dictionary, key items support:
id = [int]
status = [int]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
update_qc1_status
(
**
kwargs
)
def
write
(
self
,
**
kwargs
):
''' insert a level1 record into database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
data_type : [str]
prc_params : [str]
filename : [str]
file_path : [str]
prc_status : [int]
prc_time : [str]
pipeline_id : [str]
refs: [dict]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
write
(
**
kwargs
)
csst_dfs_api/sls/level1prc.py
deleted
100644 → 0
View file @
4cd9a653
from
..common.delegate
import
Delegate
class
Level1PrcApi
(
object
):
"""
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"sls"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level1PrcApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level1 procedure records from database
:param kwargs: Parameter dictionary, key items support:
level1_id: [int]
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 level1 procedure record into database
:param kwargs: Parameter dictionary, key items support:
level1_id : [int]
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
)
examples/ifs_rss_pipeline.py
View file @
a1e6ad7b
...
...
@@ -3,7 +3,7 @@ import logging
from
astropy.io
import
fits
from
csst_dfs_commons.logging
import
setup_logging
from
csst_dfs_api.
ifs
import
Level0DataApi
,
CalMergeApi
,
Level1DataApi
from
csst_dfs_api.
facility
import
Level0DataApi
,
Level1DataApi
setup_logging
()
log
=
logging
.
getLogger
(
'csst'
)
...
...
@@ -13,7 +13,6 @@ class RSS(object):
def
__init__
(
self
,
file_name
):
self
.
root_dir
=
os
.
getenv
(
"CSST_LOCAL_FILE_ROOT"
,
"/opt/temp/csst"
)
self
.
level0Api
=
Level0DataApi
()
self
.
calibrationApi
=
CalMergeApi
()
self
.
level1Api
=
Level1DataApi
()
try
:
...
...
Prev
1
2
Next
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