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",
)
/tmp/ipykernel_440/1409563731.py:2: DeprecationWarning: This package has reached its end of life. It is no longer maintained and will not receive any further updates or support. For further developments, please refer to the new Quantify repository: https://gitlab.com/quantify-os/quantify.All existing functionalities can be accessed via the new Quantify repository.
from quantify_core.utilities import examples_support
{'tuid': '20250904-040849-850-e7c84e',
'dataset_name': 'Bias scan',
'dataset_state': 'done',
'timestamp_start': '2025-09-04T04:08:49.850954+02:00',
'timestamp_end': '2025-09-04T04:10:49.850982+02: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': '20250904-040849-862-404aa3',
'dataset_name': 'My experiment',
'dataset_state': None,
'timestamp_start': '2025-09-04T04:08:49.862457+02:00',
'timestamp_end': '2025-09-04T04:10:49.862472+02: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': '20250904-040849-901-39e295',
'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.