3.6.1. qupulse.pulses.abstract_pulse_template¶
Classes
|
This pulse template can be used as a placeholder for a pulse template with a defined interface. |
Exceptions
|
|
- class AbstractPulseTemplate(identifier: str, *, defined_channels: Set[str | int] | None = None, parameter_names: Set[str] | None = None, measurement_names: Set[str] | None = None, integral: Dict[str | int, ExpressionScalar] | None = None, duration: ExpressionScalar | None = None, registry: MutableMapping[str, Serializable] | None = None)[source]¶
Bases:
PulseTemplateThis pulse template can be used as a placeholder for a pulse template with a defined interface. Pulse template properties like
defined_channels()can be passed on initialization to declare those properties who make up the interface. Omitted properties raise anNotSpecifiedErrorexception if accessed. Properties which have been accessed are marked as “frozen”.The abstract pulse template can be linked to another pulse template by calling the link_to member. The target has to have the same properties for all properties marked as “frozen”. This ensures a property always returns the same value.
Example
>>> abstract_readout = AbstractPulseTemplate('readout', defined_channels={'X', 'Y'}) >>> assert abstract_readout.defined_channels == {'X', 'Y'} >>> # This will raise an exception because duration is not specified >>> print(abstract_readout.duration)
- Parameters:
identifier – Mandatory property
defined_channels – Optional property
parameter_names – Optional property
measurement_names – Optional property
integral – Optional property
duration – Optional property
registry – Instance is registered here if specified
- property defined_channels: Any¶
Abstraction of
PulseTemplate.defined_channels. RaisesNotSpecifiedErrorif the abstract template is unlinked or the property was not specified.
- property duration: Any¶
Abstraction of
PulseTemplate.duration. RaisesNotSpecifiedErrorif the abstract template is unlinked or the property was not specified.
- property final_values: Any¶
Abstraction of
PulseTemplate.final_values. RaisesNotSpecifiedErrorif the abstract template is unlinked or the property was not specified.
- get_serialization_data(serializer=None) Dict[source]¶
Returns all data relevant for serialization as a dictionary containing only base types.
Implementation hint: In the old serialization routines, if the Serializable contains complex objects which are itself Serializables, a serialized representation for these MUST be obtained by calling the dictify() method of serializer. The reason is that serializer may decide to either return a dictionary to embed or only a reference to the Serializable subelement. This is DEPRECATED behavior as of May 2018. In the new routines, this will happen automatically and every Serializable is only responsible for returning it’s own data and leave nested Serializables in object form.
For the transition time where both implementations are available, implementations of this method should support the old and new routines, using the presence of the serializer argument to differentiate between both. Don’t make use of the implementation in this base class when implementing this method for the old routines.
- Parameters:
serializer (Serializer) – DEPRECATED (May 2018).A Serializer instance used to serialize complex subelements of this Serializable.
- Returns:
- A dictionary of Python base types (strings, integers, lists/tuples containing these,
etc..) which fully represent the relevant properties of this Serializable for storing and later reconstruction as a Python object.
- property initial_values: Any¶
Abstraction of
PulseTemplate.initial_values. RaisesNotSpecifiedErrorif the abstract template is unlinked or the property was not specified.
- property integral: Any¶
Abstraction of
PulseTemplate.integral. RaisesNotSpecifiedErrorif the abstract template is unlinked or the property was not specified.
- link_to(target: PulseTemplate, serialize_linked: bool = None)[source]¶
Link to another pulse template.
- Parameters:
target – Forward all getattr calls to this pulse template
serialize_linked – If true, serialization will be forwarded. Otherwise, serialization will ignore the link
- property measurement_names: Any¶
Abstraction of
PulseTemplate.measurement_names. RaisesNotSpecifiedErrorif the abstract template is unlinked or the property was not specified.
- property metadata: TemplateMetadata¶
The metadata is intended for information which does not concern the pulse itself but rather its usage.
Here is the place for program builder optimization hints or tags that are not targeted at qupulse. Currently, qupulse itself only uses the
TemplateMetadata.to_single_waveformattribute to allow dynamic atomicity during translation.As it is no property of the pulse itself, it is ignored for hashing and equality checks.
- property parameter_names: Any¶
Abstraction of
PulseTemplate.parameter_names. RaisesNotSpecifiedErrorif the abstract template is unlinked or the property was not specified.
- exception UnlinkWarning[source]¶
Bases:
UserWarning