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-commons
Commits
bdd69410
Commit
bdd69410
authored
Oct 22, 2021
by
Wei Shoulin
Browse files
level1 and sls
parent
819bce72
Changes
6
Show whitespace changes
Inline
Side-by-side
.gitignore
View file @
bdd69410
...
...
@@ -39,3 +39,5 @@ test_reports.xml
**/build/
**/dist/
**/_version.py
.hypothesis
\ No newline at end of file
csst_dfs_commons/models/common.py
View file @
bdd69410
import
dataclasses
import
copy
from
dataclasses
import
dataclass
,
field
def
from_proto_model_list
(
clazz
,
records
):
return
[
clazz
().
from_proto_model
(
r
)
for
r
in
records
]
def
from_dict_list
(
clazz
,
records
):
return
[
clazz
().
from_dict
(
r
)
for
r
in
records
]
def
to_proto_model_list
(
protoObjClazz
,
records
):
return
[
r
.
to_proto_model
(
protoObjClazz
)
for
r
in
records
]
@
dataclasses
.
dataclass
def
default_field
(
obj
):
return
field
(
default_factory
=
lambda
:
copy
.
copy
(
obj
))
@
dataclass
class
BaseModel
:
def
from_dict
(
self
,
data
=
{}):
...
...
@@ -24,13 +30,15 @@ class BaseModel:
for
k
in
self
.
__dataclass_fields__
.
keys
():
v
=
self
.
__getattribute__
(
k
)
if
v
is
not
None
:
if
isinstance
(
v
,
list
)
or
isinstance
(
v
,
tuple
)
or
isinstance
(
v
,
dict
)
:
if
isinstance
(
v
,
list
)
or
isinstance
(
v
,
tuple
):
obj
.
__getattribute__
(
k
).
extend
(
v
)
if
isinstance
(
v
,
dict
):
obj
.
__getattribute__
(
k
).
update
(
v
)
else
:
obj
.
__setattr__
(
k
,
v
)
return
obj
@
dataclass
es
.
dataclass
@
dataclass
class
Gaia3Record
(
BaseModel
):
SourceId
:
int
=
-
1
RandomIndex
:
int
=
-
1
...
...
csst_dfs_commons/models/facility.py
View file @
bdd69410
...
...
@@ -84,3 +84,14 @@ class DetectorStatus(BaseModel):
status
:
str
=
""
create_time
:
str
=
""
status_time
:
str
=
""
@
dataclasses
.
dataclass
class
Level1PrcRecord
(
BaseModel
):
id
:
int
=
0
level1_id
:
int
=
0
pipeline_id
:
str
=
""
prc_module
:
str
=
""
params_file_path
:
str
=
""
prc_status
:
int
=
0
prc_time
:
str
=
""
result_file_path
:
str
=
""
\ No newline at end of file
csst_dfs_commons/models/ifs.py
View file @
bdd69410
import
dataclass
es
from
.common
import
BaseModel
@
dataclass
es
.
dataclass
from
dataclasses
import
dataclass
from
typing
import
Dict
from
.common
import
BaseModel
,
default_field
@
dataclass
class
Level1Record
(
BaseModel
):
id
:
int
=
0
level0_id
:
str
=
""
data_type
:
str
=
""
cor_sci_id
:
int
=
0
prc_params
:
str
=
""
flat_id
:
int
=
0
dark_id
:
int
=
0
bias_id
:
int
=
0
lamp_id
:
int
=
0
arc_id
:
int
=
0
sky_id
:
int
=
0
filename
:
str
=
""
file_path
:
str
=
""
qc1_status
:
int
=
0
...
...
@@ -23,6 +17,7 @@ class Level1Record(BaseModel):
prc_time
:
str
=
""
create_time
:
str
=
""
pipeline_id
:
str
=
""
refs
:
Dict
[
str
,
int
]
=
default_field
({})
...
...
csst_dfs_commons/models/msc.py
View file @
bdd69410
import
dataclasses
from
.common
import
BaseModel
@
dataclasses
.
dataclass
from
dataclasses
import
dataclass
from
typing
import
Dict
from
.common
import
BaseModel
,
default_field
@
dataclass
class
Level1Record
(
BaseModel
):
id
:
int
=
0
level0_id
:
str
=
""
data_type
:
str
=
""
cor_sci_id
:
int
=
0
prc_params
:
str
=
""
flat_id
:
int
=
0
dark_id
:
int
=
0
bias_id
:
int
=
0
filename
:
str
=
""
file_path
:
str
=
""
qc1_status
:
int
=
0
...
...
@@ -20,6 +16,7 @@ class Level1Record(BaseModel):
prc_time
:
str
=
""
create_time
:
str
=
""
pipeline_id
:
str
=
""
refs
:
Dict
[
str
,
int
]
=
default_field
({})
...
...
csst_dfs_commons/models/sls.py
0 → 100644
View file @
bdd69410
from
dataclasses
import
dataclass
from
typing
import
Dict
from
.common
import
BaseModel
,
default_field
@
dataclass
class
Level1Record
(
BaseModel
):
id
:
int
=
0
level0_id
:
str
=
""
data_type
:
str
=
""
prc_params
:
str
=
""
filename
:
str
=
""
file_path
:
str
=
""
qc1_status
:
int
=
0
qc1_time
:
str
=
""
prc_status
:
int
=
0
prc_time
:
str
=
""
create_time
:
str
=
""
pipeline_id
:
str
=
""
refs
:
Dict
[
str
,
int
]
=
default_field
({})
@
dataclass
class
Level2Spectra
(
BaseModel
):
id
:
int
=
0
spectra_id
:
str
=
""
level1_id
:
int
=
0
region
:
str
=
""
filename
:
str
=
""
file_path
:
str
=
""
qc1_status
:
int
=
0
qc1_time
:
str
=
""
prc_status
:
int
=
0
prc_time
:
str
=
""
create_time
:
str
=
""
pipeline_id
:
str
=
""
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