storage
tergite_autocalibration.tools.mss.storage
Classes:
| Name | Description |
|---|---|
BackendProperty |
|
Functions:
| Name | Description |
|---|---|
create_redis_key |
Creates a Redis key from the given arguments, identifying a |
get_coupler_property |
Get all fields associated with the coupler property |
get_coupler_value |
Get the value associated with the coupler property |
get_qubit_property |
Get all fields associated with the qubit property |
get_qubit_value |
Get the value associated with the qubit property |
get_resonator_property |
Get all fields associated with the resonator property |
get_resonator_value |
Get the value associated with the resonator property |
set_component_property |
Set the component device property identified by |
set_coupler_property |
Write given fields into Redis for coupler property identified |
set_coupler_value |
Write given value into Redis for coupler property identified |
set_qubit_property |
Write given fields into Redis for qubit property identified |
set_qubit_value |
Write given value into Redis for qubit property identified |
set_resonator_property |
Write given fields into Redis for resonator property identified |
set_resonator_value |
Write given value into Redis for resonator property identified |
to_string |
Converts its argument into a string, such that |
utc_now_iso |
Returns current time as an ISO 8601 UTC Z string. |
utc_to_iso |
Converts a datetime instance in UTC into an ISO 8601 UTC Z string. |
BackendProperty
dataclass
BackendProperty(property_type: PropertyType, name: str, value: Optional[T] = None, unit: Optional[Unit] = None, component: Optional[str] = None, component_id: Optional[str] = None, long_name: Optional[str] = None, notes: Optional[str] = None, tags: Optional[List[str]] = None, source: Optional[str] = None)
Methods:
| Name | Description |
|---|---|
delete_property |
Deletes all Redis the key-value bindings associated with |
get_timestamp |
Returns the timestamp of the property associated with kind, |
read |
Get the backend property from Redis associated with kind, |
read_value |
Return the value associated with kind, name, component and |
reset_counter |
Reset the associated counter. Return True if successful, |
write |
Write the whole record into Redis. Suitable for initialization. |
write_metadata |
Write all non-None fields to Redis except for the "value" |
write_value |
Write the "value" field to Redis. Set the timestamp, and |
delete_property
classmethod
delete_property(property_type: PropertyType, name: str, component: Optional[str] = None, component_id: Optional[str] = None)
Deletes all Redis the key-value bindings associated with the identified property.
get_timestamp
classmethod
get_timestamp(property_type: PropertyType, name: str, component: Optional[str] = None, component_id: Optional[str] = None) -> Optional[int]
Returns the timestamp of the property associated with kind, name, component, and component_id. If no property is associated, return None.
read
classmethod
read(property_type: PropertyType, name: str, component: Optional[str] = None, component_id: Optional[str] = None) -> Optional[Tuple[_BackendProperty, TimeStamp, Counter]]
Get the backend property from Redis associated with kind, name, component, and component_id, when relevant, together with its metadata fields, plus Counter and TimeStamp (that are not class members)
read_value
classmethod
read_value(property_type: PropertyType, name: str, component: Optional[str] = None, component_id: Optional[str] = None) -> Optional[T]
Return the value associated with kind, name, component and component_id (if relevant). Note: we don't use transactions here, but maybe we should?
reset_counter
classmethod
reset_counter(property_type: PropertyType, name: str, component: Optional[str] = None, component_id: Optional[str] = None) -> bool
Reset the associated counter. Return True if successful, and False otherwise.
write_metadata
write_metadata() -> bool
Write all non-None fields to Redis except for the "value" field. Set the timestamp, but don't increase the counter.
write_value
write_value() -> bool
Write the "value" field to Redis. Set the timestamp, and increase the counter. Return True if write succeeded, and False otherwise.
create_redis_key
create_redis_key(property_type: PropertyType, name: str, component: Optional[str] = None, component_id: Optional[str] = None, field: Optional[str] = None) -> str
Creates a Redis key from the given arguments, identifying a backend property. If 'field' is omitted, the key obtained is a common prefix for all keys associated with the property.
Note: made public in order to allow other functions(e.g. in calibration framework) to use keys that may contain this key, without relying on how it actually looks.
get_coupler_property
get_coupler_property(name: str, component_id: str) -> Optional[Tuple[_BackendProperty, TimeStamp, Counter]]
Get all fields associated with the coupler property identified by the given arguments.
get_coupler_value
Get the value associated with the coupler property identified by the given arguments.
get_qubit_property
get_qubit_property(name: str, component_id: str) -> Optional[Tuple[_BackendProperty, TimeStamp, Counter]]
Get all fields associated with the qubit property identified by the given arguments.
get_qubit_value
Get the value associated with the qubit property identified by the given arguments.
get_resonator_property
get_resonator_property(name: str, component_id: str) -> Optional[Tuple[_BackendProperty, TimeStamp, Counter]]
Get all fields associated with the resonator property identified by the given arguments.
get_resonator_value
Get the value associated with the resonator property identified by the given arguments.
set_component_property
Set the component device property identified by property_type, name, component, and component_id, to the bindings given in fields.
set_coupler_property
Write given fields into Redis for coupler property identified by the given arguments.
set_coupler_value
Write given value into Redis for coupler property identified by the given arguments.
set_qubit_property
Write given fields into Redis for qubit property identified by the given arguments.
set_qubit_value
Write given value into Redis for qubit property identified by the given arguments.
set_resonator_property
Write given fields into Redis for resonator property identified by the given arguments.
set_resonator_value
Write given value into Redis for resonator property identified by the given arguments.
to_string
Converts its argument into a string, such that ast.literal_eval(o) == o. The reason for not just using repr for this purpose is that repr might be overridden by debugging tools, or hypothetically, repr could change between python versions.
NOTE: the might be objects that we haven't covered yet: they can be added later.
utc_now_iso
utc_now_iso(precision=6) -> str
Returns current time as an ISO 8601 UTC Z string.
If precision=n is provided, the fractional part of the seconds is truncated to n decimals.
utc_to_iso
Converts a datetime instance in UTC into an ISO 8601 UTC Z string.
If precision=n is provided, the fractional part of the seconds is truncated to n decimals.
NOTES: The given time t MUST be in UTC. If the timestamp was created by utcfromtimestamp, this function is suitable.