Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QuTech QDLabs
core_tools
Commits
f372030e
Commit
f372030e
authored
1 month ago
by
Sander Snoo
Browse files
Options
Downloads
Patches
Plain Diff
Reduce station snapshot
parent
07fb50c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core_tools/data/ds/data_set.py
+36
-1
36 additions, 1 deletion
core_tools/data/ds/data_set.py
with
36 additions
and
1 deletion
core_tools/data/ds/data_set.py
+
36
−
1
View file @
f372030e
import
logging
import
logging
from
core_tools.data.ds.data_set_core
import
data_set
from
core_tools.data.ds.data_set_core
import
data_set
from
core_tools.data.ds.data_set_raw
import
data_set_raw
from
core_tools.data.ds.data_set_raw
import
data_set_raw
from
core_tools.data.SQL.SQL_dataset_creator
import
SQL_dataset_creator
from
core_tools.data.SQL.SQL_dataset_creator
import
SQL_dataset_creator
import
json
import
json
...
@@ -12,6 +12,9 @@ DATA_POINTS_MAX = 20_000_000
...
@@ -12,6 +12,9 @@ DATA_POINTS_MAX = 20_000_000
DATASET_SIZE_WARNING
=
50_000_000
DATASET_SIZE_WARNING
=
50_000_000
DATASET_SIZE_MAX
=
200_000_000
DATASET_SIZE_MAX
=
200_000_000
REDUCE_SNAPSHOT
=
True
def
load_by_id
(
exp_id
):
def
load_by_id
(
exp_id
):
'''
'''
load a dataset by specifying its id (search in local db)
load a dataset by specifying its id (search in local db)
...
@@ -22,6 +25,7 @@ def load_by_id(exp_id):
...
@@ -22,6 +25,7 @@ def load_by_id(exp_id):
SQL_mgr
=
SQL_dataset_creator
()
SQL_mgr
=
SQL_dataset_creator
()
return
data_set
(
SQL_mgr
.
fetch_raw_dataset_by_Id
(
exp_id
))
return
data_set
(
SQL_mgr
.
fetch_raw_dataset_by_Id
(
exp_id
))
def
load_by_uuid
(
exp_uuid
,
copy2localdb
=
False
):
def
load_by_uuid
(
exp_uuid
,
copy2localdb
=
False
):
'''
'''
load a dataset by specifying its uuid (searches in local and remote db)
load a dataset by specifying its uuid (searches in local and remote db)
...
@@ -33,6 +37,7 @@ def load_by_uuid(exp_uuid, copy2localdb=False):
...
@@ -33,6 +37,7 @@ def load_by_uuid(exp_uuid, copy2localdb=False):
SQL_mgr
=
SQL_dataset_creator
()
SQL_mgr
=
SQL_dataset_creator
()
return
data_set
(
SQL_mgr
.
fetch_raw_dataset_by_UUID
(
exp_uuid
,
copy2localdb
))
return
data_set
(
SQL_mgr
.
fetch_raw_dataset_by_UUID
(
exp_uuid
,
copy2localdb
))
def
create_new_data_set
(
experiment_name
,
measurement_snapshot
,
*
m_params
):
def
create_new_data_set
(
experiment_name
,
measurement_snapshot
,
*
m_params
):
'''
'''
generates a dataclass for a given set of measurement parameters
generates a dataclass for a given set of measurement parameters
...
@@ -51,6 +56,8 @@ def create_new_data_set(experiment_name, measurement_snapshot, *m_params):
...
@@ -51,6 +56,8 @@ def create_new_data_set(experiment_name, measurement_snapshot, *m_params):
if
qc
.
Station
.
default
is
not
None
:
if
qc
.
Station
.
default
is
not
None
:
station_snapshot
=
qc
.
Station
.
default
.
snapshot
()
station_snapshot
=
qc
.
Station
.
default
.
snapshot
()
if
REDUCE_SNAPSHOT
:
station_snapshot
=
_reduce_snapshot
(
station_snapshot
)
snapshot
=
{
'
station
'
:
station_snapshot
}
snapshot
=
{
'
station
'
:
station_snapshot
}
else
:
else
:
logger
.
warning
(
'
No station configured. No snapshot will be stored.
'
)
logger
.
warning
(
'
No station configured. No snapshot will be stored.
'
)
...
@@ -84,3 +91,31 @@ def create_new_data_set(experiment_name, measurement_snapshot, *m_params):
...
@@ -84,3 +91,31 @@ def create_new_data_set(experiment_name, measurement_snapshot, *m_params):
return
data_set
(
ds
)
return
data_set
(
ds
)
def
_reduce_snapshot
(
snapshot
:
dict
[
str
,
any
]):
if
"
__class__
"
in
snapshot
:
exclude_keys
=
[
"
__class__
"
,
"
full_name
"
,
"
functions
"
,
"
instrument
"
,
"
instrument_name
"
,
"
inter_delay
"
,
"
post_delay
"
,
"
raw_value
"
,
"
val_mapping
"
,
"
validators
"
,
"
vals
"
,
]
else
:
exclude_keys
=
[]
result
=
{}
for
key
,
value
in
snapshot
.
items
():
if
key
not
in
exclude_keys
:
if
isinstance
(
value
,
dict
):
value
=
_reduce_snapshot
(
value
)
if
not
value
:
continue
result
[
key
]
=
value
return
result
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment