qcodes.metadatable¶
Classes:
|
|
|
Add short_name and full_name properties to Metadatable. |
Functions:
|
Normalize the |
- class qcodes.metadatable.Metadatable(metadata: Mapping[str, Any] | None = None)[source]¶
Bases:
objectMethods:
load_metadata(metadata)Load metadata into this classes metadata dictionary.
snapshot()Decorate a snapshot dictionary with metadata.
snapshot_base([update, params_to_skip_update])Override this with the primary information for a subclass.
- load_metadata(metadata: Mapping[str, Any]) None[source]¶
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- final snapshot(update: Literal['All', 'Only_invalid', 'Never'] = 'Only_invalid') dict[str, Any][source]¶
- final snapshot(update: bool | None = 'Only_invalid') dict[str, Any]
Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override
snapshot_base().- Parameters:
update –
What to do about the values stored in the snapshot; passed to
snapshot_base()after being normalized to aSnapshotUpdatevalue."All": force an update of every value."Only_invalid"(the default): only update values whose cache is invalid, using the latest cached value otherwise."Never": never update, always use the latest values in memory.
The legacy
True/None/Falsevalues are deprecated aliases for"All"/"Only_invalid"/"Never"and are still accepted for backwards compatibility (no warning is raised).- Returns:
Base snapshot.
- class qcodes.metadatable.MetadatableWithName(metadata: Mapping[str, Any] | None = None)[source]¶
Bases:
MetadatableAdd short_name and full_name properties to Metadatable. This is used as a base class for all components in QCoDeS that are members of a station to ensure that they have a name and consistent interface.
Methods:
load_metadata(metadata)Load metadata into this classes metadata dictionary.
snapshot([update])Decorate a snapshot dictionary with metadata.
snapshot_base([update, params_to_skip_update])Override this with the primary information for a subclass.
Attributes:
Name excluding name of any parent that this object is bound to.
Name including name of any parent that this object is bound to separated by '_'.
- load_metadata(metadata: Mapping[str, Any]) None¶
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- snapshot(update: bool | Literal['All', 'Only_invalid', 'Never'] | None = 'Only_invalid') dict[str, Any]¶
Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override
snapshot_base().- Parameters:
update –
What to do about the values stored in the snapshot; passed to
snapshot_base()after being normalized to aSnapshotUpdatevalue."All": force an update of every value."Only_invalid"(the default): only update values whose cache is invalid, using the latest cached value otherwise."Never": never update, always use the latest values in memory.
The legacy
True/None/Falsevalues are deprecated aliases for"All"/"Only_invalid"/"Never"and are still accepted for backwards compatibility (no warning is raised).- Returns:
Base snapshot.
- qcodes.metadatable.normalize_snapshot_update(update: bool | Literal['All', 'Only_invalid', 'Never'] | None) Literal['All', 'Only_invalid', 'Never'][source]¶
Normalize the
updateargument ofsnapshot/snapshot_baseinto one of the canonicalSnapshotUpdatestring values.The legacy values
True,NoneandFalseare mapped to"All","Only_invalid"and"Never"respectively, and the canonical string values are returned unchanged. This is the single place where theupdateargument is interpreted; all internal code should work with the returnedSnapshotUpdatevalue rather than with the legacybool/Nonerepresentation.- Parameters:
update – The
updateargument as passed tosnapshot/snapshot_base.- Returns:
The equivalent canonical
SnapshotUpdatevalue.- Raises:
ValueError – If
updateis a string that is not a validSnapshotUpdatevalue.