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
1e1f9508
Commit
1e1f9508
authored
Oct 22, 2021
by
Wei Shoulin
Browse files
level1 and sls
parent
59ce47d1
Changes
14
Hide whitespace changes
Inline
Side-by-side
.hypothesis/unicode_data/11.0.0/charmap.json.gz
0 → 100644
View file @
1e1f9508
File added
README.md
View file @
1e1f9508
...
@@ -18,7 +18,7 @@ python setup.py install
...
@@ -18,7 +18,7 @@ python setup.py install
`csst-dfs-api`
and relevant packages could be installed by running one of the following commands in your terminal.
`csst-dfs-api`
and relevant packages could be installed by running one of the following commands in your terminal.
```
bash
```
bash
sh
-c
"
$(
curl
-fsSL
https://raw.fastgit.org/astronomical-data-processing/csst-dfs-api/master/tools/csst-dfs-api-install.sh
)
"
- v0.0.
2
sh
-c
"
$(
curl
-fsSL
https://raw.fastgit.org/astronomical-data-processing/csst-dfs-api/master/tools/csst-dfs-api-install.sh
)
"
- v0.0.
4
```
```
...
...
csst_dfs_api/facility/level1prc.py
0 → 100644
View file @
1e1f9508
from
..common.delegate
import
Delegate
class
Level1PrcApi
(
object
):
"""
Level 0 Data Operation API
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"facility"
)
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/ifs/level1.py
View file @
1e1f9508
...
@@ -15,7 +15,6 @@ class Level1DataApi(object):
...
@@ -15,7 +15,6 @@ class Level1DataApi(object):
:param kwargs: Parameter dictionary, key items support:
:param kwargs: Parameter dictionary, key items support:
level0_id: [str],
level0_id: [str],
data_type: [str],
data_type: [str],
obs_type: [str],
create_time : (start, end),
create_time : (start, end),
qc1_status : [int],
qc1_status : [int],
prc_status : [int],
prc_status : [int],
...
@@ -67,17 +66,12 @@ class Level1DataApi(object):
...
@@ -67,17 +66,12 @@ class Level1DataApi(object):
data_type : [str]
data_type : [str]
cor_sci_id : [int]
cor_sci_id : [int]
prc_params : [str]
prc_params : [str]
flat_id : [int]
dark_id : [int]
bias_id : [int]
lamp_id : [int]
arc_id : [int]
sky_id : [int]
filename : [str]
filename : [str]
file_path : [str]
file_path : [str]
prc_status : [int]
prc_status : [int]
prc_time : [str]
prc_time : [str]
pipeline_id : [str]
pipeline_id : [str]
refs: [dict]
:returns: csst_dfs_common.models.Result
:returns: csst_dfs_common.models.Result
'''
'''
...
...
csst_dfs_api/msc/level1.py
View file @
1e1f9508
...
@@ -15,7 +15,6 @@ class Level1DataApi(object):
...
@@ -15,7 +15,6 @@ class Level1DataApi(object):
:param kwargs: Parameter dictionary, key items support:
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
level0_id: [str]
data_type: [str]
data_type: [str]
obs_type: [str]
create_time : (start, end),
create_time : (start, end),
qc1_status : [int],
qc1_status : [int],
prc_status : [int],
prc_status : [int],
...
@@ -67,14 +66,12 @@ class Level1DataApi(object):
...
@@ -67,14 +66,12 @@ class Level1DataApi(object):
data_type : [str]
data_type : [str]
cor_sci_id : [int]
cor_sci_id : [int]
prc_params : [str]
prc_params : [str]
flat_id : [int]
dark_id : [int]
bias_id : [int]
filename : [str]
filename : [str]
file_path : [str]
file_path : [str]
prc_status : [int]
prc_status : [int]
prc_time : [str]
prc_time : [str]
pipeline_id : [str]
pipeline_id : [str]
refs: [dict]
:returns: csst_dfs_common.models.Result
:returns: csst_dfs_common.models.Result
'''
'''
...
...
csst_dfs_api/sls/__init__.py
0 → 100644
View file @
1e1f9508
from
.level1
import
Level1DataApi
from
.level2spectra
import
Level2SpectraApi
\ No newline at end of file
csst_dfs_api/sls/level1.py
0 → 100644
View file @
1e1f9508
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
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]
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/level2spectra.py
0 → 100644
View file @
1e1f9508
from
..common.delegate
import
Delegate
class
Level2SpectraApi
(
object
):
"""
Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"sls"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level2SpectraApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level2 spectra records from database
:param kwargs: Parameter dictionary, key items support:
level1_id: [int]
spectra_id: [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:
level1_id: [int]
spectra_id : [str]
region : [str]
filename : [str]
file_path : [str]
prc_status : [int]
prc_time : [str]
pipeline_id : [str]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
write
(
**
kwargs
)
examples/demo_facility_level1_prc.py
0 → 100644
View file @
1e1f9508
from
csst_dfs_api.facility.level1prc
import
Level1PrcApi
api
=
Level1PrcApi
()
#find
recs
=
api
.
find
(
level1_id
=
3
)
print
(
'find:'
,
recs
)
#update_proc_status
rec
=
api
.
update_proc_status
(
id
=
2
,
status
=
4
)
print
(
'update_proc_status:'
,
rec
)
#write
rec
=
api
.
write
(
level1_id
=
3
,
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
tests/test_facility_level1_prc.py
0 → 100644
View file @
1e1f9508
import
os
import
unittest
from
astropy.io
import
fits
from
csst_dfs_api.facility.level1prc
import
Level1PrcApi
class
Level1PrcTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
Level1PrcApi
()
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
level1_id
=
1
)
print
(
'find:'
,
recs
)
def
test_update_proc_status
(
self
):
rec
=
self
.
api
.
update_proc_status
(
id
=
1
,
status
=
4
)
print
(
'update_proc_status:'
,
rec
)
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
level1_id
=
1
,
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
tests/test_ifs_level1.py
View file @
1e1f9508
...
@@ -12,7 +12,7 @@ class IFSLevel1DataTestCase(unittest.TestCase):
...
@@ -12,7 +12,7 @@ class IFSLevel1DataTestCase(unittest.TestCase):
def
test_find
(
self
):
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
recs
=
self
.
api
.
find
(
level0_id
=
'000001201'
,
level0_id
=
'000001201'
,
create_time
=
(
"2021-0
6
-01 11:12:13"
,
"2021-
06
-08 11:12:13"
))
create_time
=
(
"2021-
1
0-01 11:12:13"
,
"2021-
11
-08 11:12:13"
))
print
(
'find:'
,
recs
)
print
(
'find:'
,
recs
)
def
test_get
(
self
):
def
test_get
(
self
):
...
@@ -33,15 +33,10 @@ class IFSLevel1DataTestCase(unittest.TestCase):
...
@@ -33,15 +33,10 @@ class IFSLevel1DataTestCase(unittest.TestCase):
data_type
=
"sci"
,
data_type
=
"sci"
,
cor_sci_id
=
2
,
cor_sci_id
=
2
,
prc_params
=
"/opt/dddasd.params"
,
prc_params
=
"/opt/dddasd.params"
,
flat_id
=
1
,
dark_id
=
2
,
bias_id
=
3
,
lamp_id
=
4
,
arc_id
=
5
,
sky_id
=
6
,
prc_status
=
3
,
prc_status
=
3
,
prc_time
=
'2021-06-05 11:12:13'
,
prc_time
=
'2021-06-05 11:12:13'
,
filename
=
"dddasd"
,
filename
=
"MSC_MS_210525121500_100000001_09_raw"
,
file_path
=
"/opt/dddasd.fits"
,
file_path
=
"/opt/temp/csst/MSC_MS_210525121500_100000001_09_raw.fits"
,
pipeline_id
=
"P2"
)
pipeline_id
=
"P2"
,
refs
=
{
'dark'
:
1
,
'bias'
:
2
,
'flat'
:
3
,
'sky'
:
33
})
print
(
'write:'
,
rec
)
print
(
'write:'
,
rec
)
\ No newline at end of file
tests/test_msc_level1.py
View file @
1e1f9508
...
@@ -33,12 +33,10 @@ class MSCLevel1DataTestCase(unittest.TestCase):
...
@@ -33,12 +33,10 @@ class MSCLevel1DataTestCase(unittest.TestCase):
data_type
=
"sci"
,
data_type
=
"sci"
,
cor_sci_id
=
1
,
cor_sci_id
=
1
,
prc_params
=
"/opt/dddasd.params"
,
prc_params
=
"/opt/dddasd.params"
,
flat_id
=
1
,
dark_id
=
2
,
bias_id
=
3
,
prc_status
=
3
,
prc_status
=
3
,
prc_time
=
'2021-06-04 11:12:13'
,
prc_time
=
'2021-10-22 11:12:13'
,
filename
=
"dddasdfff"
,
filename
=
"MSC_MS_210525121500_100000001_09_raw"
,
file_path
=
"/opt/dddasd.fits"
,
file_path
=
"/opt/temp/csst/MSC_MS_210525121500_100000001_09_raw.fits"
,
pipeline_id
=
"P1"
)
pipeline_id
=
"P1"
,
refs
=
{
'dark'
:
1
,
'bias'
:
2
,
'flat'
:
3
})
print
(
'write:'
,
rec
)
print
(
'write:'
,
rec
)
\ No newline at end of file
tests/test_sls_level1.py
0 → 100644
View file @
1e1f9508
import
unittest
from
csst_dfs_api.sls
import
Level1DataApi
class
SLSResult1TestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
Level1DataApi
()
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
level0_id
=
'0000223'
,
create_time
=
(
"2021-06-01 11:12:13"
,
"2021-06-08 11:12:13"
)
)
print
(
'find:'
,
recs
)
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_qc1_status
(
self
):
rec
=
self
.
api
.
update_qc1_status
(
id
=
1
,
status
=
7
)
print
(
'update_qc1_status:'
,
rec
)
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
level0_id
=
'0000223'
,
data_type
=
"sci"
,
prc_params
=
"/opt/dddasd.params"
,
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"
,
pipeline_id
=
"P2"
,
refs
=
{
'dark'
:
1
,
'bias'
:
2
,
'flat'
:
3
})
print
(
'write:'
,
rec
)
\ No newline at end of file
tests/test_sls_level2_spectra.py
0 → 100644
View file @
1e1f9508
import
unittest
from
csst_dfs_api.sls
import
Level2SpectraApi
class
SLSLevel2SpectraTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
Level2SpectraApi
()
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
level1_id
=
1
,
create_time
=
(
"2021-06-01 11:12:13"
,
"2021-06-08 11:12:13"
)
)
print
(
'find:'
,
recs
)
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_qc1_status
(
self
):
rec
=
self
.
api
.
update_qc1_status
(
id
=
1
,
status
=
7
)
print
(
'update_qc1_status:'
,
rec
)
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
level1_id
=
2
,
spectra_id
=
"222"
,
region
=
"[12,13,24,24]"
,
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"
,
pipeline_id
=
"P2"
)
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