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
Return type

Optional[Loop]

Returns

A Loop object corresponding to this PulseTemplate.

abstract property defined_channels

Returns the number of hardware output channels this PulseTemplate defines.

Return type

Set[Union[str, int]]

abstract property duration

An expression for the duration of this PulseTemplate.

Return type

ExpressionScalar

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.

Return type

Set[str]

property num_channels

The number of channels this PulseTemplate defines

Return type

int

abstract property parameter_names

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

Return type

Set[str]

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

property atomicity
Return type

bool

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

Optional[Waveform]

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.

Return type

Set[str]

exception qupulse.pulses.pulse_template.DoubleParameterNameException(templateA, templateB, names)[source]

Bases: Exception