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

  • MultiChannelWaveform: A waveform defined for several channels by combining waveforms

class qupulse.pulses.multi_channel_pulse_template.AtomicMultiChannelPulseTemplate(*subtemplates, identifier=None, parameter_constraints=None, measurements=None, registry=None, duration=None)[source]

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

Combines multiple PulseTemplates that are defined on different channels into an AtomicPulseTemplate.

Parallels multiple AtomicPulseTemplates of the same duration. 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 (Optional[str]) – Forwarded to AtomicPulseTemplate.__init__

  • parameter_constraints (Optional[List]) – Forwarded to ParameterConstrainer.__init__

  • measurements (Optional[List[Tuple[str, Union[Expression, str, Real], Union[Expression, str, Real]]]]) – Forwarded to AtomicPulseTemplate.__init__

  • duration (Optional[~ExpressionLike]) – Enforced duration of the pulse template on instantiation. build_waveform checks all sub-waveforms

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

__init__(*subtemplates, identifier=None, parameter_constraints=None, measurements=None, registry=None, duration=None)[source]

Parallels multiple AtomicPulseTemplates of the same duration. 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 (Optional[str]) – Forwarded to AtomicPulseTemplate.__init__

  • parameter_constraints (Optional[List]) – Forwarded to ParameterConstrainer.__init__

  • measurements (Optional[List[Tuple[str, Union[Expression, str, Real], Union[Expression, str, Real]]]]) – Forwarded to AtomicPulseTemplate.__init__

  • duration (Optional[~ExpressionLike]) – Enforced duration of the pulse template on instantiation. build_waveform checks all sub-waveforms

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

build_waveform(parameters, channel_mapping)[source]

Implements build_waveform().

Return type

Optional[Waveform]

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

Implements defined_channels.

Return type

Set[Union[str, int]]

classmethod deserialize(serializer=None, **kwargs)[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 (Optional[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.

Return type

AtomicMultiChannelPulseTemplate

property duration: qupulse.expressions.ExpressionScalar

Implements duration.

Return type

ExpressionScalar

get_measurement_windows(parameters, measurement_mapping)[source]

Calculate measurement windows with the given parameter set and rename them woth the measurement mapping

Return type

List[Tuple[str, Real, Real]]

get_serialization_data(serializer=None)[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.

Return type

Dict[str, Any]

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 integral: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Implements integral.

Return type

Dict[Union[str, int], ExpressionScalar]

property measurement_names: Set[str]

Implements measurement_names.

Return type

Set[str]

property parameter_names: Set[str]

Implements parameter_names.

Return type

Set[str]

property subtemplates: Sequence[Union[qupulse.pulses.pulse_template.AtomicPulseTemplate, qupulse.pulses.mapping_pulse_template.MappingPulseTemplate]]
Return type

Sequence[Union[AtomicPulseTemplate, MappingPulseTemplate]]

class qupulse.pulses.multi_channel_pulse_template.ParallelConstantChannelPulseTemplate(template, overwritten_channels, *, identifier=None, registry=None)[source]

Bases: qupulse.pulses.pulse_template.PulseTemplate

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

build_waveform(parameters, channel_mapping)[source]
Return type

Optional[Waveform]

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

Implements defined_channels.

Return type

Set[Union[str, int]]

property duration: qupulse.expressions.ExpressionScalar

Implements duration.

Return type

ExpressionScalar

get_serialization_data(serializer=None)[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.

Return type

Dict[str, Any]

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 integral: Dict[Union[str, int], qupulse.expressions.ExpressionScalar]

Implements integral.

Return type

Dict[Union[str, int], ExpressionScalar]

property measurement_names: Set[str]

Implements measurement_names.

Return type

Set[str]

property overwritten_channels: Mapping[str, qupulse.expressions.ExpressionScalar]
Return type

Mapping[str, ExpressionScalar]

property parameter_names

Implements parameter_names.

property template: qupulse.pulses.pulse_template.PulseTemplate
Return type

PulseTemplate

property transformation_parameters: Set[str]
Return type

Set[str]