3.6.12. qupulse.pulses.pulse_template¶
This module defines the abstract PulseTemplate class which is the basis of any pulse model in the qupulse.
- Classes:
PulseTemplate: Represents the parametrized general structure of a pulse.
- AtomicPulseTemplate: PulseTemplate that does imply any control flow disruptions and can be
directly translated into a waveform.
-
class
qupulse.pulses.pulse_template.
PulseTemplate
(*, identifier)[source]¶ Bases:
qupulse.serialization.Serializable
A PulseTemplate represents the parametrized general structure of a pulse.
A PulseTemplate described a pulse in an abstract way: It defines the structure of a pulse but might leave some timings or voltage levels undefined, thus declaring parameters. This allows to reuse a PulseTemplate for several pulses which have the same overall structure and differ only in concrete values for the parameters. Obtaining an actual pulse which can be executed by specifying values for these parameters is called instantiation of the PulseTemplate and achieved by invoking the sequencing process.
Initializes a Serializable.
- Parameters
identifier (
Optional
[str
]) – An optional, non-empty identifier for this Serializable. If set, this Serializable will always be stored as a separate data item and never be embedded.- Raises
ValueError – If identifier is the empty string
-
create_program
(*, parameters=None, measurement_mapping=None, channel_mapping=None, global_transformation=None, to_single_waveform=None, volatile=None)[source]¶ Translates this PulseTemplate into a program Loop.
The returned Loop represents the PulseTemplate with all parameter values instantiated provided as dictated by the parameters argument. Optionally, channels and measurements defined in the PulseTemplate can be renamed/mapped via the channel_mapping and measurement_mapping arguments.
- Parameters
parameters (
Optional
[Mapping
[str
,Union
[Expression
,str
,Number
,ConstantParameter
]]]) – A mapping of parameter names to Parameter objects.measurement_mapping (
Optional
[Mapping
[str
,Optional
[str
]]]) – A mapping of measurement window names. Windows that are mapped to None are omitted.channel_mapping (
Optional
[Mapping
[Union
[str
,int
],Union
[str
,int
,None
]]]) – A mapping of channel names. Channels that are mapped to None are omitted.global_transformation (
Optional
[Transformation
]) – This transformation is applied to every waveformto_single_waveform (
Optional
[Set
[Union
[str
,PulseTemplate
]]]) – A set of pulse templates (or identifiers) which are directly translated to a waveform. This might change how transformations are applied. TODO: clarifyvolatile (
Optional
[Set
[str
]]) – Everything in the final program that depends on these parameters is marked as volatile
- Return type
- Returns
A Loop object corresponding to this PulseTemplate.
-
abstract property
defined_channels
¶ Returns the number of hardware output channels this PulseTemplate defines.
-
abstract property
duration
¶ An expression for the duration of this PulseTemplate.
- Return type
-
abstract property
integral
¶ Returns an expression giving the integral over the pulse.
- Return type
Dict
[Union
[str
,int
],ExpressionScalar
]
-
abstract property
measurement_names
¶ The set of measurement identifiers in this pulse template.
-
class
qupulse.pulses.pulse_template.
AtomicPulseTemplate
(*, identifier, measurements)[source]¶ Bases:
qupulse.pulses.pulse_template.PulseTemplate
,qupulse.pulses.measurement.MeasurementDefiner
A PulseTemplate that does not imply any control flow disruptions and can be directly translated into a waveform.
Implies that no AtomicPulseTemplate object is interruptable.
Initializes a Serializable.
- Parameters
identifier (
Optional
[str
]) – An optional, non-empty identifier for this Serializable. If set, this Serializable will always be stored as a separate data item and never be embedded.- Raises
ValueError – If identifier is the empty string
-
abstract
build_waveform
(parameters, channel_mapping)[source]¶ Translate this PulseTemplate into a waveform according to the given parameters.
Subclasses of AtomicPulseTemplate must check for ParameterConstraintViolation errors in their build_waveform implementation and raise corresponding exceptions.
- Parameters
parameters (Dict(str -> Parameter)) – A mapping of parameter names to real numbers.
channel_mapping (Dict(ChannelID -> ChannelID) – A mapping of Channel IDs
- Return type
- Returns
- Waveform object represented by this PulseTemplate object or None, if this object
does not represent a valid waveform of finite length.
-
property
measurement_names
¶ Implements
measurement_names
.