3.5.1. qupulse.program.linspace¶
Functions
|
translate the given linspace node tree to a minimal sequence of set and increment commands as well as loops. |
|
Classes
|
The key that identifies how a certain set command depends on iteration indices. |
|
|
|
|
|
This is just a wrapper to pipe arbitrary waveforms through the system. |
|
This program builder supports efficient translation of pulse templates that use symbolic linearly spaced voltages and durations. |
|
Hold voltages for a given time. |
|
Iteration in linear space are restricted to range 0 to length. |
AST node for a program that supports linear spacing of set points as well as nested sequencing and repetitions |
|
|
|
|
Repeat the body count times. |
|
|
|
|
|
|
|
|
|
|
|
- class DepKey(factors: Tuple[int, ...])[source]¶
Bases:
objectThe key that identifies how a certain set command depends on iteration indices. The factors are rounded with a given resolution to be independent on rounding errors.
These objects allow backends which support it to track multiple amplitudes at once.
- class DepState(base: float, iterations: Tuple[int, ...])[source]¶
Bases:
object- required_increment_from(previous: DepState, factors: Sequence[float]) float[source]¶
Calculate the required increment from the previous state to the current given the factors that determine the voltage dependency of each index.
By convention there are only two possible values for each iteration index integer in self: 0 or the last index The three possible increments for each iteration are none, regular and jump to next line.
The previous dependency state can have a different iteration length if the trailing factors now or during the last iteration are zero.
- Parameters:
previous – The previous state to calculate the required increment from. It has to belong to the same DepKey.
factors – The number of factors has to be the same as the current number of iterations.
- Returns:
The increment
- class Increment(channel: int, value: float, dependency_key: qupulse.program.linspace.DepKey)[source]¶
Bases:
object
- class LinSpaceArbitraryWaveform(waveform: Waveform, channels: Tuple[int | str, ...])[source]¶
Bases:
LinSpaceNodeThis is just a wrapper to pipe arbitrary waveforms through the system.
- dependencies() Mapping[int, set[Tuple[float, ...]]][source]¶
Returns a mapping from channel indices to the iteration indices dependencies that those channels have inside this node.
- Returns:
Mapping from channel indices to the iteration indices dependencies
- reversed(offset: int, lengths: list)[source]¶
Get the time reversed version of this linspace node. Since this is a non-local operation the arguments give the context.
- Parameters:
offset – Active iterations that are not reserved
lengths – Lengths of the currently active iterations that have to be reversed
- Returns:
Time reversed version.
- class LinSpaceBuilder(channels: Tuple[int | str, ...])[source]¶
Bases:
BaseProgramBuilderThis program builder supports efficient translation of pulse templates that use symbolic linearly spaced voltages and durations.
The channel identifiers are reduced to their index in the given channel tuple.
Arbitrary waveforms are not implemented yet
- inner_scope(scope: Scope) Scope[source]¶
This function is necessary to inject program builder specific parameter implementations into the build process.
- new_subprogram(global_transformation: Transformation = None) ContextManager[ProgramBuilder][source]¶
Create a context managed program builder whose contents are translated into a single waveform upon exit if it is not empty.
- Returns:
A context manager that returns a
ProgramBuilderon entering.
- time_reversed() Iterable[LinSpaceBuilder][source]¶
This returns a new context manager that will reverse everything added to it in time upon exit.
- Returns:
A context manager that returns a
ProgramBuilderon entering.
- to_program() LinSpaceProgram | None[source]¶
Generate the final program. This is allowed to invalidate the program builder.
- Returns:
A program implementation. None if nothing was added to this program builder.
- with_iteration(index_name: str, rng: range, measurements: Sequence[Tuple[str, Real, Real]] | None = None) Iterable[ProgramBuilder][source]¶
Create an iterable that represent the body of the iteration. This can be an iterable with an element for each step in the iteration or a single object that represents the complete iteration.
- Parameters:
index_name – The name of index
rng – The range if the index
measurements – Measurements to add iff the iteration body is not empty.
- with_repetition(repetition_count: int | VolatileRepetitionCount | DynamicLinearValue[int], measurements: Sequence[Tuple[str, Real, Real]] | None = None) Iterable[ProgramBuilder][source]¶
Start a new repetition context with given repetition count. The caller has to iterate over the return value and call :py:meth:.ProgramBuilder.inner_scope` inside the iteration context.
- Parameters:
repetition_count – Repetition count
measurements – These measurements are added relative to the position at the start of the iteration iff the iteration is not empty.
- Returns:
An iterable of
ProgramBuilderinstances.
- with_sequence(measurements: Sequence[Tuple[str, Real, Real]] | None = None) Iterable[ProgramBuilder][source]¶
Start a new sequence context. The caller has to enter the returned context manager and add the sequenced elements there.
Measurements that are added in to the returned program builder are discarded if the sequence is empty on exit.
- Parameters:
measurements – These measurements are added relative to the position at the start of the sequence iff the
empty. (sequence is not)
- Returns:
A context manager that returns a
ProgramBuilderon entering.
- class LinSpaceHold(bases: Tuple[float, ...], factors: Tuple[Tuple[float, ...] | None, ...], duration_base: TimeType, duration_factors: Tuple[TimeType, ...] | None)[source]¶
Bases:
LinSpaceNodeHold voltages for a given time. The voltages and the time may depend on the iteration index.
- dependencies() Mapping[int, set][source]¶
Returns a mapping from channel indices to the iteration indices dependencies that those channels have inside this node.
- Returns:
Mapping from channel indices to the iteration indices dependencies
- reversed(offset: int, lengths: list)[source]¶
Get the time reversed version of this linspace node. Since this is a non-local operation the arguments give the context.
- Parameters:
offset – Active iterations that are not reserved
lengths – Lengths of the currently active iterations that have to be reversed
- Returns:
Time reversed version.
- class LinSpaceIter(body: Tuple[LinSpaceNode, ...], length: int)[source]¶
Bases:
LinSpaceNodeIteration in linear space are restricted to range 0 to length.
Offsets and spacing are stored in the hold node.
- body: Tuple[LinSpaceNode, ...]¶
- dependencies()[source]¶
Returns a mapping from channel indices to the iteration indices dependencies that those channels have inside this node.
- Returns:
Mapping from channel indices to the iteration indices dependencies
- reversed(offset: int, lengths: list)[source]¶
Get the time reversed version of this linspace node. Since this is a non-local operation the arguments give the context.
- Parameters:
offset – Active iterations that are not reserved
lengths – Lengths of the currently active iterations that have to be reversed
- Returns:
Time reversed version.
- class LinSpaceNode[source]¶
Bases:
ABCAST node for a program that supports linear spacing of set points as well as nested sequencing and repetitions
- abstractmethod dependencies() Mapping[int, set[Tuple[float, ...]]][source]¶
Returns a mapping from channel indices to the iteration indices dependencies that those channels have inside this node.
- Returns:
Mapping from channel indices to the iteration indices dependencies
- reversed(offset: int, lengths: list)[source]¶
Get the time reversed version of this linspace node. Since this is a non-local operation the arguments give the context.
- Parameters:
offset – Active iterations that are not reserved
lengths – Lengths of the currently active iterations that have to be reversed
- Returns:
Time reversed version.
- class LinSpaceProgram(root: Tuple[qupulse.program.linspace.LinSpaceNode, ...], defined_channels: Tuple[int | str, ...])[source]¶
Bases:
Program- get_defined_channels() AbstractSet[str | int][source]¶
Get the set of channels that are used in this program.
- get_waveforms_dict(channels: Sequence[str | int], channel_transformations: Mapping[str | int, ChannelTransformation]) Mapping[Waveform, Any][source]¶
- root: Tuple[LinSpaceNode, ...]¶
- class LinSpaceRepeat(body: Tuple[LinSpaceNode, ...], count: int)[source]¶
Bases:
LinSpaceNodeRepeat the body count times.
- body: Tuple[LinSpaceNode, ...]¶
- dependencies()[source]¶
Returns a mapping from channel indices to the iteration indices dependencies that those channels have inside this node.
- Returns:
Mapping from channel indices to the iteration indices dependencies
- reversed(offset: int, counts: list)[source]¶
Get the time reversed version of this linspace node. Since this is a non-local operation the arguments give the context.
- Parameters:
offset – Active iterations that are not reserved
lengths – Lengths of the currently active iterations that have to be reversed
- Returns:
Time reversed version.
- class LinSpaceVM(channels: int, sample_resolution: TimeType = TimeType(1, 2))[source]¶
Bases:
object
- class Play(waveform: qupulse.program.waveforms.Waveform, channels: Tuple[str | int])[source]¶
Bases:
object
- class Set(channel: int, value: float, key: qupulse.program.linspace.DepKey = <factory>)[source]¶
Bases:
object