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
67343023
Commit
67343023
authored
Feb 15, 2023
by
Wei Shoulin
Browse files
qc1->qc2
parent
a1e6ad7b
Changes
6
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api/common/utils.py
View file @
67343023
...
...
@@ -41,6 +41,12 @@ def to_int(s, default_value = 0):
except
:
return
default_value
def
to_float
(
s
,
default_value
=
0
):
try
:
return
float
(
s
)
except
:
return
default_value
def
singleton
(
cls
):
_instance
=
{}
...
...
@@ -119,6 +125,6 @@ def object_list_to_table(query_result):
t
.
add_row
(
tuple
([
rec
.
__getattribute__
(
k
)
for
k
in
fields
]))
return
t
def
get_nextId_by_prefix
(
prefix
):
def
get_nextId_by_prefix
(
prefix
:
str
):
pymodule
=
Delegate
().
load
(
sub_module
=
"common.utils"
)
return
getattr
(
pymodule
,
"get_nextId_by_prefix"
)(
prefix
)
\ No newline at end of file
csst_dfs_api/ifs/__init__.py
View file @
67343023
from
.level1
import
Level1DataApi
from
.level1prc
import
Level1PrcApi
\ No newline at end of file
csst_dfs_api/ifs/level1.py
deleted
100644 → 0
View file @
a1e6ad7b
from
..common.delegate
import
Delegate
class
Level1DataApi
(
object
):
"""
IFS Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"ifs"
)
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/ifs/level1prc.py
deleted
100644 → 0
View file @
a1e6ad7b
from
..common.delegate
import
Delegate
class
Level1PrcApi
(
object
):
"""
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"ifs"
)
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/sls/level2spectra.py
View file @
67343023
...
...
@@ -17,7 +17,7 @@ class Level2SpectraApi(object):
level1_id: [int]
spectra_id: [str]
create_time : (start, end),
qc
1
_status : [int],
qc
2
_status : [int],
prc_status : [int],
filename: [str]
limit: limits returns the number of records,default 0:no-limit
...
...
@@ -48,8 +48,8 @@ class Level2SpectraApi(object):
'''
return
self
.
stub
.
update_proc_status
(
**
kwargs
)
def
update_qc
1
_status
(
self
,
**
kwargs
):
''' update the status of QC
1
def
update_qc
2
_status
(
self
,
**
kwargs
):
''' update the status of QC
2
:param kwargs: Parameter dictionary, key items support:
id = [int],
...
...
@@ -57,10 +57,10 @@ class Level2SpectraApi(object):
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
update_qc
1
_status
(
**
kwargs
)
return
self
.
stub
.
update_qc
2
_status
(
**
kwargs
)
def
write
(
self
,
**
kwargs
):
''' insert a level
1
record into database
''' insert a level
2
record into database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
...
...
tests/facility/test_facility_cal_merge.py
deleted
100644 → 0
View file @
a1e6ad7b
import
unittest
from
csst_dfs_api.facility.calmerge
import
CalMergeApi
class
MSCCalMergeApiTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
CalMergeApi
()
def
test_find
(
self
):
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
)
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
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