3.7.9. qupulse.pulses.multi_channel_pulse_template

This module defines MultiChannelPulseTemplate, which allows the combination of several AtomicPulseTemplates into a single template spanning several channels.

Classes:
  • MultiChannelPulseTemplate: A pulse template defined for several channels by combining pulse

    templates

  • ParallelChannelPulseTemplate: A pulse template to add channels to an existing pulse template.

Classes

AtomicMultiChannelPulseTemplate(*subtemplates)

Combines multiple AtomicPulseTemplates of the same duration that are defined on different channels into an AtomicPulseTemplate.

ParallelChannelPulseTemplate(template, ...)

Pulse template to add new or overwrite existing channels of a contained pulse template.

ParallelConstantChannelPulseTemplate

alias of qupulse.pulses.multi_channel_pulse_template.ParallelChannelPulseTemplate

Exceptions

ChannelMappingException(obj1, obj2, ...)

class qupulse.pulses.multi_channel_pulse_template.AtomicMultiChannelPulseTemplate(*subtemplates: Union[qupulse.pulses.pulse_template.AtomicPulseTemplate, Tuple[PulseTemplate], Tuple[PulseTemplate, Dict], Tuple[PulseTemplate, Dict, Dict], Tuple[PulseTemplate, Dict, Dict, Dict], qupulse.pulses.mapping_pulse_template.MappingPulseTemplate], identifier: Optional[str] = None, parameter_constraints: Optional[List] = None, measurements: Optional[List[Tuple[str, Union[qupulse.expressions.sympy.Expression, str, numbers.Real], Union[qupulse.expressions.sympy.Expression, str, numbers.Real]]]] = None, registry: Optional[MutableMapping[str, Serializable]] = None, duration: Optional[qupulse.expressions.ExpressionLike] = None)[source]

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

Combines multiple AtomicPulseTemplates of the same duration that are defined on different channels into an AtomicPulseTemplate. If the duration keyword argument is given it is enforced that the instantiated pulse template has this duration. If duration is None the duration of the PT is the duration of the first subtemplate. There are probably changes to this behaviour in the future.

Parameters
  • *subtemplates – Positional arguments are subtemplates to combine.

  • identifier – Forwarded to AtomicPulseTemplate.__init__

  • parameter_constraints – Forwarded to ParameterConstrainer.__init__

  • measurements – Forwarded to AtomicPulseTemplate.__init__

  • duration – Enforced duration of the pulse template on instantiation. build_waveform checks all sub-waveforms

  • construction. (have this duration. If True the equality of durations is only checked durtin instantiation not) –

__init__(*subtemplates: Union[qupulse.pulses.pulse_template.AtomicPulseTemplate, Tuple[PulseTemplate], Tuple[PulseTemplate, Dict], Tuple[PulseTemplate, Dict, Dict], Tuple[PulseTemplate, Dict, Dict, Dict], qupulse.pulses.mapping_pulse_template.MappingPulseTemplate], identifier: Optional[str] = None, parameter_constraints: Optional[List] = None, measurements: Optional[List[Tuple[str, Union[qupulse.expressions.sympy.Expression, str, numbers.Real], Union[qupulse.expressions.sympy.Expression, str, numbers.Real]]]] = None, registry: Optional[MutableMapping[str, Serializable]] = None, duration: Optional[qupulse.expressions.ExpressionLike] = None) None[source]

Combines multiple AtomicPulseTemplates of the same duration that are defined on different channels into an AtomicPulseTemplate. If the duration keyword argument is given it is enforced that the instantiated pulse template has this duration. If duration is None the duration of the PT is the duration of the first subtemplate. There are probably changes to this behaviour in the future.

Parameters
  • *subtemplates – Positional arguments are subtemplates to combine.

  • identifier – Forwarded to AtomicPulseTemplate.__init__

  • parameter_constraints – Forwarded to ParameterConstrainer.__init__

  • measurements – Forwarded to AtomicPulseTemplate.__init__

  • duration – Enforced duration of the pulse template on instantiation. build_waveform checks all sub-waveforms

  • construction. (have this duration. If True the equality of durations is only checked durtin instantiation not) –

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

Implements build_waveform().

property defined_channels: AbstractSet[Union[str, int]]

Implements defined_channels.

classmethod deserialize(serializer: Optional[qupulse.serialization.Serializer] = None, **kwargs) qupulse.pulses.multi_channel_pulse_template.AtomicMultiChannelPulseTemplate[source]

Reconstructs the Serializable object from a dictionary.

Implementation hint: For greater clarity, implementations of this method should be precise in their return value, i.e., give their exact class name, and also replace the kwargs argument by a list of arguments required, i.e., those returned by get_serialization_data. Using old serialization routines, if this Serializable contains complex objects which are itself of type Serializable, their dictionary representations MUST be converted into objects using serializers deserialize() method. This is DEPRECATED behavior. Using the new routines, a serializable is only responsible to decode it’s own dictionary, not those of nested objects (i.e., all incoming arguments are already processed by the serialization routines). For the transition time where both variants are available, implementations of this method should support the old and new routines, using the presence of the serializer argument to differentiate between both. For the new routines, just call this base class function. After the transition period, subclasses likely need not implement deserialize separately anymore at all.

Parameters
  • serializer – DEPRECATED (May 2018). A serializer instance used when deserializing subelements.

  • **kwargs – All relevant properties of the object as keyword arguments. For every (key,value) pair returned by get_serialization_data, the same pair is given as keyword argument as input to this method.

property duration: qupulse.expressions.sympy.ExpressionScalar

Implements duration.

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

Values of defined channels at t == self.duration

get_measurement_windows(parameters: Dict[str, numbers.Real], measurement_mapping: Dict[str, Optional[str]]) List[Tuple[str, numbers.Real, numbers.Real]][source]

Calculate measurement windows with the given parameter set and rename them with the measurement mapping. This method only returns the measurement windows that are defined on self. It does _not_ collect the measurement windows defined on eventual child objects that self has/is composed of.

Parameters
  • parameters – Used to calculate the numeric begins and lengths of symbolically defined measurement windows.

  • measurement_mapping – Used to rename/drop measurement windows. Windows mapped to None are dropped.

Returns

List of measurement windows directly defined on self

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.

property measurement_names: Set[str]

Implements measurement_names.

property parameter_names: AbstractSet[str]

Implements parameter_names.

property subtemplates: Sequence[Union[qupulse.pulses.pulse_template.AtomicPulseTemplate, qupulse.pulses.mapping_pulse_template.MappingPulseTemplate]]
with_parallel_atomic(*parallel: qupulse.pulses.pulse_template.AtomicPulseTemplate) qupulse.pulses.pulse_template.AtomicPulseTemplate[source]
qupulse.pulses.multi_channel_pulse_template.ParallelConstantChannelPulseTemplate

alias of qupulse.pulses.multi_channel_pulse_template.ParallelChannelPulseTemplate