3.5.4. qupulse.program.transformation

Transformations to be applied to sampled waveform data (offset/scale/virtual gates).

Functions

chain_transformations(*transformations)

linear_transformation_from_pandas(transformation)

Creates a LinearTransformation object out of a pandas data frame.

Classes

ChainedTransformation(*transformations)

IdentityTransformation()

LinearTransformation(transformation_matrix, ...)

OffsetTransformation(offsets)

Adds an offset to each channel specified in offsets.

ParallelChannelTransformation(channels)

Set channel values to given values regardless their former existence.

ScalingTransformation(factors)

Transformation()

class ChainedTransformation(*transformations: Transformation)[source]

Bases: Transformation

chain(next_transformation) Transformation[source]
property compare_key: Tuple[Transformation, ...]
get_constant_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]
get_input_channels(output_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_input_channels().

get_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_output_channels().

is_constant_invariant()[source]

Signals if the transformation always maps constants to constants.

property transformations: Tuple[Transformation, ...]
class IdentityTransformation[source]

Bases: Transformation

chain(next_transformation: Transformation) Transformation[source]
property compare_key: None
get_constant_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]
get_input_channels(output_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_input_channels().

get_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_output_channels().

is_constant_invariant()[source]

Signals if the transformation always maps constants to constants.

class LinearTransformation(transformation_matrix: ndarray, input_channels: Sequence[str | int], output_channels: Sequence[str | int])[source]

Bases: Transformation

Parameters:
  • transformation_matrix – Matrix describing the transformation with shape (output_channels, input_channels)

  • input_channels – Channel ids of the columns

  • output_channels – Channel ids of the rows

property compare_key: Tuple[Tuple[str | int], Tuple[str | int], bytes]
from_pandas() LinearTransformation

Creates a LinearTransformation object out of a pandas data frame.

Parameters:

transformation (pandas.DataFrame) – The pandas.DataFrame object out of which a LinearTransformation will be formed.

Returns:

the created LinearTransformation instance

get_constant_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]
get_input_channels(output_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_input_channels().

get_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_output_channels().

is_constant_invariant()[source]

Signals if the transformation always maps constants to constants.

class OffsetTransformation(offsets: Mapping[str | int, Real | ExpressionScalar | DynamicLinearValue])[source]

Bases: Transformation

Adds an offset to each channel specified in offsets.

Channels not in offsets are forewarded

Parameters:

offsets – Channel -> offset mapping

property compare_key: Hashable
contains_dynamic_value() bool[source]
get_constant_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]
get_input_channels(output_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_input_channels().

get_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_output_channels().

is_constant_invariant()[source]

Signals if the transformation always maps constants to constants.

class ParallelChannelTransformation(channels: Mapping[str | int, Real | ExpressionScalar | DynamicLinearValue])[source]

Bases: Transformation

Set channel values to given values regardless their former existence. The values can be time dependent expressions.

Parameters:

channels – Channels present in this map are set to the given value.

property compare_key: Hashable
contains_dynamic_value() bool[source]
get_constant_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]
get_input_channels(output_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_input_channels().

get_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_output_channels().

is_constant_invariant()[source]

Signals if the transformation always maps constants to constants.

class ScalingTransformation(factors: Mapping[str | int, Real | ExpressionScalar | DynamicLinearValue])[source]

Bases: Transformation

property compare_key: Hashable
contains_dynamic_value() bool[source]
get_constant_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]
get_input_channels(output_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_input_channels().

get_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Implements Transformation.get_output_channels().

is_constant_invariant()[source]

Signals if the transformation always maps constants to constants.

class Transformation[source]

Bases: object

chain(next_transformation: Transformation) Transformation[source]
contains_dynamic_value() bool[source]
get_constant_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]
abstractmethod get_input_channels(output_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Channels that are required for getting data for the requested output channel

abstractmethod get_output_channels(input_channels: AbstractSet[str | int]) AbstractSet[str | int][source]

Return the channel identifiers

is_constant_invariant()[source]

Signals if the transformation always maps constants to constants.

chain_transformations(*transformations: Transformation) Transformation[source]