3.7.18. qupulse.pulses.table_pulse_template

This module defines the TablePulseTemplate, one of the elementary pulse templates and its waveform representation.

Classes:
  • TablePulseTemplate: Defines a pulse via interpolation of a sequence of (time,voltage)-pairs.

  • TableWaveform: A waveform instantiated from a TablePulseTemplate by providing values for its

    declared parameters.

Functions

concatenate(*table_pulse_templates, **kwargs)

Concatenate two or more table pulse templates

Classes

TableEntry(t, v[, interp])

Create new instance of TableEntry(t, v, interp)

TablePulseTemplate(entries[, identifier, ...])

The TablePulseTemplate class implements pulses described by a table with time, voltage and interpolation strategy inputs.

Exceptions

AmbiguousTablePulseEntry

ZeroDurationTablePulseTemplate

class qupulse.pulses.table_pulse_template.TablePulseTemplate(entries: Dict[Union[str, int], Sequence[Union[TableEntry, Tuple[Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real], Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real]], Tuple[Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real], Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real], Union[str, qupulse.pulses.interpolation.InterpolationStrategy]]]]], identifier: Optional[str] = None, *, parameter_constraints: Optional[List[Union[str, qupulse.pulses.parameters.ParameterConstraint]]] = None, measurements: Optional[List[Tuple[str, Union[qupulse.expressions.sympy.Expression, str, numbers.Real], Union[qupulse.expressions.sympy.Expression, str, numbers.Real]]]] = None, consistency_check: bool = True, registry: Optional[MutableMapping[str, Serializable]] = None)[source]

Bases: qupulse.pulses.pulse_template.AtomicPulseTemplate, qupulse.pulses.parameters.ParameterConstrainer

The TablePulseTemplate class implements pulses described by a table with time, voltage and interpolation strategy inputs. The interpolation strategy describes how the voltage between the entries is interpolated(see also InterpolationStrategy.) It can define multiple channels of which each has a separate table. If they do not have the same length the shorter channels are extended to the longest duration.

If the time entries of all channels are equal it is more convenient to use the :paramrefPointPulseTemplate`.

Construct a TablePulseTemplate from a dict which maps channels to their entries. By default the consistency of the provided entries is checked. There are two static functions for convenience construction: from_array and from_entry_list.

Parameters
  • entries – A dictionary that maps channel ids to a list of entries. An entry is a (time, voltage[, interpolation strategy]) tuple or a TableEntry

  • identifier – Used for serialization

  • parameter_constraints – Constraint list that is forwarded to the ParameterConstrainer superclass

  • measurements – Measurement declaration list that is forwarded to the MeasurementDefiner superclass

  • consistency_check – If True the consistency of the times will be checked on construction as far as possible

__init__(entries: Dict[Union[str, int], Sequence[Union[TableEntry, Tuple[Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real], Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real]], Tuple[Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real], Union[qupulse.expressions.sympy.ExpressionScalar, str, numbers.Real], Union[str, qupulse.pulses.interpolation.InterpolationStrategy]]]]], identifier: Optional[str] = None, *, parameter_constraints: Optional[List[Union[str, qupulse.pulses.parameters.ParameterConstraint]]] = None, measurements: Optional[List[Tuple[str, Union[qupulse.expressions.sympy.Expression, str, numbers.Real], Union[qupulse.expressions.sympy.Expression, str, numbers.Real]]]] = None, consistency_check: bool = True, registry: Optional[MutableMapping[str, Serializable]] = None) None[source]

Construct a TablePulseTemplate from a dict which maps channels to their entries. By default the consistency of the provided entries is checked. There are two static functions for convenience construction: from_array and from_entry_list.

Parameters
  • entries – A dictionary that maps channel ids to a list of entries. An entry is a (time, voltage[, interpolation strategy]) tuple or a TableEntry

  • identifier – Used for serialization

  • parameter_constraints – Constraint list that is forwarded to the ParameterConstrainer superclass

  • measurements – Measurement declaration list that is forwarded to the MeasurementDefiner superclass

  • consistency_check – If True the consistency of the times will be checked on construction as far as possible

build_waveform(parameters: Dict[str, numbers.Real], channel_mapping: Dict[Union[str, int], Optional[Union[str, int]]]) Optional[Union[qupulse.program.waveforms.TableWaveform, qupulse.program.waveforms.MultiChannelWaveform]][source]

Implements build_waveform().

calculate_duration() qupulse.expressions.sympy.ExpressionScalar[source]
property defined_channels: Set[Union[str, int]]

Implements defined_channels.

property duration: qupulse.expressions.sympy.ExpressionScalar

Implements duration.

property entries: Dict[Union[str, int], List[qupulse.pulses.table_pulse_template.TableEntry]]
property final_values: Dict[Union[str, int], qupulse.expressions.sympy.ExpressionScalar]

Values of defined channels at t == self.duration

static from_array(times: numpy.ndarray, voltages: numpy.ndarray, channels: List[Union[str, int]]) qupulse.pulses.table_pulse_template.TablePulseTemplate[source]

Static constructor to build a TablePulse from numpy arrays.

Parameters
  • times – 1D numpy array with time values

  • voltages – 1D or 2D numpy array with voltage values

  • channels – channels to define

Returns

TablePulseTemplate with the given values, hold interpolation everywhere and no free parameters.

static from_entry_list(entry_list: List[Tuple], channel_names: Optional[List[Union[str, int]]] = None, **kwargs) qupulse.pulses.table_pulse_template.TablePulseTemplate[source]

Static constructor for a TablePulseTemplate where all channel’s entries share the same times.

Parameters
  • entry_list – List of tuples of the form (t, v_1, …, v_N[, interp])

  • channel_names – Optional list of channel identifiers to use. Default is [0, …, N-1]

  • kwargs – Forwarded to TablePulseTemplate constructor

Returns

TablePulseTemplate with

get_entries_instantiated(parameters: Dict[str, numbers.Real]) Dict[Union[str, int], List[qupulse.program.waveforms.TableWaveformEntry]][source]

Compute an instantiated list of the table’s entries.

Parameters

parameters (Dict(str -> Parameter)) – A mapping of parameter names to Parameter objects.

Returns

(float, float)-list of all table entries with concrete values provided by the given

parameters.

get_serialization_data(serializer: Optional[qupulse.serialization.Serializer] = None) Dict[str, Any][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: Dict[Union[str, int], qupulse.expressions.sympy.ExpressionScalar]

Values of defined channels at t == 0

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

Implements integral.

interpolation_strategies = {'default': <Hold Interpolation>, 'hold': <Hold Interpolation>, 'jump': <Jump Interpolation>, 'linear': <Linear Interpolation>}
property parameter_names: Set[str]

Implements parameter_names.

property table_parameters: Set[str]
qupulse.pulses.table_pulse_template.concatenate(*table_pulse_templates: qupulse.pulses.table_pulse_template.TablePulseTemplate, **kwargs) qupulse.pulses.table_pulse_template.TablePulseTemplate[source]

Concatenate two or more table pulse templates