Operations#

The operations subpackage encapsulates the concepts that specify the operations and targets of instructions.

keysight.qcs.operations.BaseOperation

A base class for operations acting on Targets.

keysight.qcs.operations.Targets

A base class for a collection of unique targets represented by labels.

keysight.qcs.operations.TargetMap

A class used to remap targets.

keysight.qcs.operations.TargetedOperation

A class representing a target/operation pair.

Base Operation#

class keysight.qcs.operations.BaseOperation#

Bases: CsWrapper

A base class for operations acting on Targets.

property name: str | None#

The name of this operation.

property assert_variables_have_values#

Assert that all variables in this operation have values.

property slice_width: int | None#

The number of targets this operation can be broadcast to.

property yield_variables: Generator[Variable]#

Yield the variables of this operation.

broadcast(prefix: str, length: int) BaseOperation#

Returns a new operation where any scalars have been broadcast to arrays.

Parameters:
  • prefix – The prefix to use when broadcasting variables.

  • length – The length of the resulting arrays.

Targets#

class keysight.qcs.operations.Targets#

A base class for a collection of unique targets represented by labels.

Raises:

ValueError – If there are duplicate labels.

property labels: tuple[int, ...]#

The labels of this collection of targets.

property name: str#

The name of this collection of targets.

match(other: Targets) int | list[int]#

Returns the indices of the labels in this that are present in other.

Parameters:

other – The targets to match.

overlap(other: Targets) bool#

Tests whether two targets overlap in name and labels.

class keysight.qcs.operations.TargetMap(target: Targets)#

A class used to remap targets.

Parameters:

target – The target to be remapped.

property label_map: dict[int, Targets]#

The map from labels in targets to new targets.

property targets: Targets#

The targets to be remapped.

all_mapped() bool#

Checks whether all the elements of targets are mapped to new targets.

get(idxs: SliceLike) Targets#

Get the merged targets for the given indices.

Param:

The indices of targets to get.

insert(label: int, target: Targets) None#

Insert an element into this.

Parameters:
  • label – The label to map.

  • target – The target to map the label to.

Targeted Operations#

class keysight.qcs.operations.TargetedOperation(operation: BaseOperation, target: Targets)#

A class representing a target/operation pair.

Parameters:
  • operation – The operation.

  • target – The target.

property operation: BaseOperation#

The operation.

property target: Targets#

The target.