3.6.1. qupulse.pulses.abstract_pulse_template¶
-
class
qupulse.pulses.abstract_pulse_template.
AbstractPulseTemplate
(identifier, *, defined_channels=None, parameter_names=None, measurement_names=None, integral=None, duration=None, registry=None)[source]¶ Bases:
qupulse.pulses.pulse_template.PulseTemplate
This pulse template can be used as a place holder 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 anNotSpecifiedError
exception 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 (
str
) – Mandatory propertydefined_channels (
Optional
[Set
[Union
[str
,int
]]]) – Optional propertyintegral (
Optional
[Dict
[Union
[str
,int
],ExpressionScalar
]]) – Optional propertyduration (
Optional
[ExpressionScalar
]) – Optional propertyregistry (
Optional
[MutableMapping
[str
,Serializable
]]) – Instance is registered here if specified
-
__init__
(identifier, *, defined_channels=None, parameter_names=None, measurement_names=None, integral=None, duration=None, registry=None)[source]¶ This pulse template can be used as a place holder 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 anNotSpecifiedError
exception 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 (
str
) – Mandatory propertydefined_channels (
Optional
[Set
[Union
[str
,int
]]]) – Optional propertyintegral (
Optional
[Dict
[Union
[str
,int
],ExpressionScalar
]]) – Optional propertyduration (
Optional
[ExpressionScalar
]) – Optional propertyregistry (
Optional
[MutableMapping
[str
,Serializable
]]) – Instance is registered here if specified
-
property
defined_channels
¶ Abstraction of
PulseTemplate.defined_channels
. RaisesNotSpecifiedError
if the abstract template is unlinked or the property was not specified.
-
property
duration
¶ Abstraction of
PulseTemplate.duration
. RaisesNotSpecifiedError
if the abstract template is unlinked or the property was not specified.
-
get_serialization_data
(serializer=None)[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.
- Return type
- 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
integral
¶ Abstraction of
PulseTemplate.integral
. RaisesNotSpecifiedError
if the abstract template is unlinked or the property was not specified.
-
link_to
(target, serialize_linked=None)[source]¶ Link to another pulse template.
- Parameters
target (
PulseTemplate
) – Forward all getattr calls to this pulse templateserialize_linked (
Optional
[bool
]) – If true, serialization will be forwarded. Otherwise serialization will ignore the link
-
property
measurement_names
¶ Abstraction of
PulseTemplate.measurement_names
. RaisesNotSpecifiedError
if the abstract template is unlinked or the property was not specified.
-
property
parameter_names
¶ Abstraction of
PulseTemplate.parameter_names
. RaisesNotSpecifiedError
if the abstract template is unlinked or the property was not specified.
-
exception
qupulse.pulses.abstract_pulse_template.
UnlinkWarning
[source]¶ Bases:
UserWarning