3.6.8. 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, external_parameters=None, identifier=None, parameter_constraints=None, measurements=None, registry=None, duration=False)[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. The duration equality check is performed on construction by default. If the duration keyword argument is given the check is performed on instantiation (when build_waveform is called). duration can be a Expression to enforce a certain duration or True for an unspecified duration.

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 (Union[str, Expression, bool]) – 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) –

  • external_parameters (Optional[Set[str]]) – No functionality. (Deprecated)

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

Parallels multiple AtomicPulseTemplates of the same duration. The duration equality check is performed on construction by default. If the duration keyword argument is given the check is performed on instantiation (when build_waveform is called). duration can be a Expression to enforce a certain duration or True for an unspecified duration.

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 (Union[str, Expression, bool]) – 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) –

  • external_parameters (Optional[Set[str]]) – No functionality. (Deprecated)

Return type

None

build_waveform(parameters, channel_mapping)[source]

Implements build_waveform().

Return type

Optional[Waveform]

property defined_channels

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

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

Implements integral.

Return type

Dict[Union[str, int], ExpressionScalar]

property measurement_names

Implements measurement_names.

Return type

Set[str]

property parameter_names

Implements parameter_names.

Return type

Set[str]

property subtemplates
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

Implements defined_channels.

Return type

Set[Union[str, int]]

property duration

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

Implements integral.

Return type

Dict[Union[str, int], ExpressionScalar]

property measurement_names

Implements measurement_names.

Return type

Set[str]

property overwritten_channels
Return type

Mapping[str, ExpressionScalar]

property parameter_names

Implements parameter_names.

property template
Return type

PulseTemplate

property transformation_parameters
Return type

Set[str]