Dataset Attributes#
Required dataset attributes#
Required dataset attributes
are specified in a dataclass QDatasetAttrs
.
All attributes are mandatory to be present in the dataset but can be None
or empty.
import datetime
from quantify_core.utilities import examples_support
examples_support.mk_dataset_attrs(
dataset_name="Bias scan",
timestamp_start=datetime.datetime.now().astimezone().isoformat(),
timestamp_end=(datetime.datetime.now().astimezone() + datetime.timedelta(seconds=120)).isoformat(),
dataset_state="done",
)
{'tuid': '20241106-152932-431-3febef',
'dataset_name': 'Bias scan',
'dataset_state': 'done',
'timestamp_start': '2024-11-06T15:29:32.431540+00:00',
'timestamp_end': '2024-11-06T15:31:32.431561+00:00',
'quantify_dataset_version': '2.0.0',
'software_versions': {},
'relationships': [],
'json_serialize_exclude': []}
It may be necessary to specify versions of the key software components that were used to generate a dataset.
This can be done using software_versions
attribute, using either a published version or Git commit hash:
examples_support.mk_dataset_attrs(
dataset_name="My experiment",
timestamp_start=datetime.datetime.now().astimezone().isoformat(),
timestamp_end=(datetime.datetime.now().astimezone() + datetime.timedelta(seconds=120)).isoformat(),
software_versions={
"lab_fridge_magnet_driver": "1.4.2", # software version/tag
"my_lab_repo": "9d8acf63f48c469c1b9fa9f2c3cf230845f67b18", # git commit hash
},
)
{'tuid': '20241106-152932-446-60ddbb',
'dataset_name': 'My experiment',
'dataset_state': None,
'timestamp_start': '2024-11-06T15:29:32.446864+00:00',
'timestamp_end': '2024-11-06T15:31:32.446877+00:00',
'quantify_dataset_version': '2.0.0',
'software_versions': {'lab_fridge_magnet_driver': '1.4.2',
'my_lab_repo': '9d8acf63f48c469c1b9fa9f2c3cf230845f67b18'},
'relationships': [],
'json_serialize_exclude': []}
Required dataset coordinate attributes#
Required coordinate data array attributes
are specified in a dataclass QCoordAttrs
.
All attributes are mandatory to be present in the dataset but can be None
.
from quantify_core.utilities import examples_support
examples_support.mk_main_coord_attrs()
{'unit': '',
'long_name': '',
'is_main_coord': True,
'uniformly_spaced': True,
'is_dataset_ref': False,
'json_serialize_exclude': []}
examples_support.mk_secondary_coord_attrs()
{'unit': '',
'long_name': '',
'is_main_coord': False,
'uniformly_spaced': True,
'is_dataset_ref': False,
'json_serialize_exclude': []}
Required dataset data variables attributes#
Required data variable data array attributes
are specified in a dataclass QVarAttrs
.
All attributes are mandatory to be present in the dataset but can be None
.
from quantify_core.utilities import examples_support
examples_support.mk_main_var_attrs(coords=["time"])
{'unit': '',
'long_name': '',
'is_main_var': True,
'uniformly_spaced': True,
'grid': True,
'is_dataset_ref': False,
'has_repetitions': False,
'json_serialize_exclude': [],
'coords': ['time']}
examples_support.mk_secondary_var_attrs(coords=["cal"])
{'unit': '',
'long_name': '',
'is_main_var': False,
'uniformly_spaced': True,
'grid': True,
'is_dataset_ref': False,
'has_repetitions': False,
'json_serialize_exclude': [],
'coords': ['cal']}
Relationship between primary and secondary variables#
This is how the attributes of a dataset containing a q0
main variable and q0_cal
secondary variables would look like.
The q0_cal
corresponds to calibrations datapoints.
from quantify_core.data.dataset_attrs import QDatasetIntraRelationship
from quantify_core.utilities import examples_support
examples_support.mk_dataset_attrs(
relationships=[
QDatasetIntraRelationship(
item_name="q0",
relation_type="calibration",
related_names=["q0_cal"],
).to_dict()
]
)
{'tuid': '20241106-152932-485-bfb20e',
'dataset_name': '',
'dataset_state': None,
'timestamp_start': None,
'timestamp_end': None,
'quantify_dataset_version': '2.0.0',
'software_versions': {},
'relationships': [{'item_name': 'q0',
'relation_type': 'calibration',
'related_names': ['q0_cal'],
'relation_metadata': {}}],
'json_serialize_exclude': []}
See Quantify dataset - examples for examples with more context.