3.6.3. qupulse.pulses.constant_pulse_template¶
This module defines the ConstantPulseTemplate, a pulse template representing a pulse with constant values on all channels.
Classes
|
An atomic pulse template qupulse representing a multi-channel pulse with constant values. |
- class ConstantPulseTemplate(duration: ExpressionLike, amplitude_dict: Dict[str | int, ExpressionLike], identifier: str | None = None, name: str | None = None, measurements: List[Tuple[str, Expression | str | Real, Expression | str | Real]] | None = None, registry: MutableMapping[str, Serializable] | None = None, metadata: TemplateMetadata | dict = None)[source]¶
Bases:
AtomicPulseTemplateAn atomic pulse template qupulse representing a multi-channel pulse with constant values.
As an optimization, this class does not convert plain floats or ints to qupulse expressions.
- Parameters:
duration – Duration of the template
amplitude_dict – Dictionary with values for the channels
identifier – Optional identifier for the pulse
name – Name for the template. Not used by qupulse
measurements – Passed to
MeasurementDefinersuperclassregistry – The pulse is registered in this mapping after construction if an identifier is provided
- build_waveform(parameters: Dict[str, Real], channel_mapping: Dict[str | int, str | int | None]) ConstantWaveform | MultiChannelWaveform | None[source]¶
Implements
AtomicPulseTemplate.build_waveform().
- property defined_channels: AbstractSet[str | int]¶
Returns the number of hardware output channels this PulseTemplate defines.
- classmethod deserialize(serializer: Optional = None, **kwargs) ConstantPulseTemplate[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: ExpressionScalar¶
An expression for the duration of this PulseTemplate.
- property final_values: Dict[str | int, ExpressionScalar]¶
Values of defined channels at t == self.duration
- get_serialization_data(serializer=None) 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[str | int, ExpressionScalar]¶
Values of defined channels at t == 0
- property integral: Dict[str | int, ExpressionScalar]¶
Returns an expression giving the integral over the pulse.
- property parameter_names: AbstractSet[str]¶
The set of names of parameters required to instantiate this PulseTemplate.