3.5.13. 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.

Classes

AtomicPulseTemplate(*, identifier, measurements)

A PulseTemplate that does not imply any control flow disruptions and can be directly translated into a waveform.

PulseTemplate(*, identifier)

A PulseTemplate represents the parametrized general structure of a pulse.

Exceptions

DoubleParameterNameException(templateA, ...)

class qupulse.pulses.pulse_template.AtomicPulseTemplate(*, identifier: Optional[str], measurements: Optional[List[Tuple[str, Union[qupulse.expressions.Expression, str, numbers.Real], Union[qupulse.expressions.Expression, str, numbers.Real]]]])[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 – 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

property atomicity: bool
abstract build_waveform(parameters: Mapping[str, numbers.Real], channel_mapping: Dict[Union[str, int], Optional[Union[str, int]]]) Optional[qupulse._program.waveforms.Waveform][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

Returns

Waveform object represented by this PulseTemplate object or None, if this object

does not represent a valid waveform of finite length.

property final_values: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Values of defined channels at t == self.duration

property initial_values: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Values of defined channels at t == 0

property integral: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Implements integral.

property measurement_names: Set[str]

Return the names of measurements that are directly declared on self. Does _not_ visit eventual child objects.

exception qupulse.pulses.pulse_template.DoubleParameterNameException(templateA: qupulse.pulses.pulse_template.PulseTemplate, templateB: qupulse.pulses.pulse_template.PulseTemplate, names: Set[str])[source]

Bases: Exception

class qupulse.pulses.pulse_template.PulseTemplate(*, identifier: Optional[str])[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 – 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: Optional[Mapping[str, Union[qupulse.expressions.Expression, str, numbers.Number, qupulse.pulses.parameters.ConstantParameter]]] = None, measurement_mapping: Optional[Mapping[str, Optional[str]]] = None, channel_mapping: Optional[Mapping[Union[str, int], Optional[Union[str, int]]]] = None, global_transformation: Optional[qupulse._program.transformation.Transformation] = None, to_single_waveform: Optional[Set[Union[str, qupulse.pulses.pulse_template.PulseTemplate]]] = None, volatile: Optional[Set[str]] = None) Optional[qupulse._program._loop.Loop][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 – A mapping of parameter names to Parameter objects.

  • measurement_mapping – A mapping of measurement window names. Windows that are mapped to None are omitted.

  • channel_mapping – A mapping of channel names. Channels that are mapped to None are omitted.

  • global_transformation – This transformation is applied to every waveform

  • to_single_waveform – A set of pulse templates (or identifiers) which are directly translated to a waveform. This might change how transformations are applied. TODO: clarify

  • volatile – Everything in the final program that depends on these parameters is marked as volatile

Returns

A Loop object corresponding to this PulseTemplate.

abstract property defined_channels: Set[Union[str, int]]

Returns the number of hardware output channels this PulseTemplate defines.

abstract property duration: qupulse.expressions.ExpressionScalar

An expression for the duration of this PulseTemplate.

property final_values: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Values of defined channels at t == self.duration

property initial_values: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Values of defined channels at t == 0

abstract property integral: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Returns an expression giving the integral over the pulse.

abstract property measurement_names: Set[str]

The set of measurement identifiers in this pulse template.

property num_channels: int

The number of channels this PulseTemplate defines

abstract property parameter_names: Set[str]

The set of names of parameters required to instantiate this PulseTemplate.