Skip to content

geope.gecko¤

geope.gecko.Gecko ¤

Null-space optimiser for GEOPE solutions.

Gecko post-processes an optimized Pulse solution: it moves the parameters within the Jacobian null space so that fidelity is preserved while an auxiliary cost is improved.

Gecko is constructed from a Parameters object.

g = Geope(p); g.optimize()
Gecko(g.params).smooth(...)

The cost is an Objective from geope.objectives, or a weighted sum of them, passed to :meth:optimize::

Gecko(g.params).optimize(Smoothness() + 0.1 * PulseLength())

The single-objective methods (smooth, speed, bound, ...) are shorthands for one term.

Because the functions are cached on params, Gecko reuses the Geope's already-compiled traces rather than recompiling.

Attributes:

Name Type Description
params

The bound Parameters object.

history

Optional History logger. None by default.

#TODO

do we need this to be public? Only used in optimize

step_size

Transient last optimisation rate.

costs

The unweighted value of each objective term at the last iteration, keyed by term name (WeightedSum.names). Refreshed every iteration, so callbacks can read it.

pulse_constraints

Optional pulse-shape constraint config.

constraint_expander

Linear-equality constraint expander (from params).

.. note:: The Parameters object is shared with the source Geope. A null-space pass with piecewise_steps_multiplier > 1 subdivides the pulse and advances params.parameters / params.piecewise_steps in place — so the shared Geope's state moves forward too, and a later geope.optimize() continues from the subdivided pulse.

__dict__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__weakref__ property ¤

list of weak references to the object

__init__(params, history=None, verbose=False) ¤

Initialise the Gecko optimiser.

Parameters:

Name Type Description Default
params Parameters

A Parameters instance — the same object a Geope uses. Pass a Geope's geope.params to post-process its solution; the cached optimisation functions are reused.

required
history History | None

Optional History logger. When supplied, the run trajectory is recorded into it.

None
verbose bool

Whether to print progress. Defaults to False.

False

Raises:

Type Description
TypeError

If params is not a Parameters instance.

optimize(objective, *, piecewise_steps_multiplier=1, rate=0.01, max_steps=100, diff_tol=0.1, callbacks=None) ¤

Minimise an objective, or a weighted sum of objectives, in the null space.

Minimises the raw linear combination \(C(\phi) = \sum_i w_i c_i(\phi)\) by fixed-length steps along the null-space projection of \(-\nabla C\), so fidelity is preserved to first order. Only the ratios of the weights shape the trajectory; their overall scale changes what diff_tol means. Each term's unweighted value is reported every iteration in self.costs.

Parameters:

Name Type Description Default
objective Objective | WeightedSum

An Objective (e.g. Smoothness()) or a WeightedSum built with * and +, e.g. Smoothness() + 0.1 * PeakAmplitude(parameter_labels=["XI"]).

required
piecewise_steps_multiplier int

Factor by which to subdivide the gate segments before the pass. Defaults to 1.

1
rate float

Length of each step in parameter space. Defaults to 0.01.

0.01
max_steps int

Maximum iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance on the combined cost \(C\). Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
bool

A tuple (success, iters) where success is True if

int

diff_tol was reached.

smooth(piecewise_steps_multiplier=1, smoothing_rate=0.01, max_smoothing_steps=100, diff_tol=0.1, callbacks=None) ¤

Smooth the piecewise-constant pulse by null-space optimisation.

Minimises the differences between consecutive gate segments (Smoothness) while remaining in the null space of the Jacobian so that fidelity is preserved.

Parameters:

Name Type Description Default
piecewise_steps_multiplier int

Factor by which to increase the number of gate segments. Defaults to 1.

1
smoothing_rate float

Step length for the null-space update. Defaults to 0.01.

0.01
max_smoothing_steps int

Maximum smoothing iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance on the smoothing cost. Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
bool

A tuple (success, iters) where success is True if

int

diff_tol was reached.

smooth_frequency(piecewise_steps_multiplier=1, smoothing_rate=0.01, max_smoothing_steps=100, diff_tol=0.1, callbacks=None) ¤

Suppress high-frequency spectral power in the pulse (SpectralPower).

Parameters:

Name Type Description Default
piecewise_steps_multiplier int

Factor by which to subdivide gate segments. Defaults to 1.

1
smoothing_rate float

Step length. Defaults to 0.01.

0.01
max_smoothing_steps int

Maximum iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance on the spectral cost. Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
tuple[bool, int]

A tuple (success, iters).

filter_frequency(filter_fn, piecewise_steps_multiplier=1, smoothing_rate=0.01, max_smoothing_steps=100, diff_tol=0.1, callbacks=None) ¤

Drive the pulse toward filter_fn(rfft(pulse)) (FrequencyFilter).

Parameters:

Name Type Description Default
filter_fn Callable[[Array], Array]

Complex-array filter applied to the rfft of phi.

required
piecewise_steps_multiplier int

Factor by which to subdivide gate segments. Defaults to 1.

1
smoothing_rate float

Step length. Defaults to 0.01.

0.01
max_smoothing_steps int

Maximum iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance. Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
tuple[bool, int]

A tuple (success, iters).

speed(parameter_labels=None, parameter_indices=None, piecewise_steps_multiplier=1, optimization_rate=0.01, max_optimization_steps=100, diff_tol=0.1, callbacks=None) ¤

Minimise the peak amplitude of selected projected parameters.

Cost (PeakAmplitude): \(\max_{g,k\in P}|\phi_k(g)|\). Minimising it raises the gate-speed limit.

Parameters:

Name Type Description Default
parameter_labels list[str] | None

Projected-basis labels to minimise.

None
parameter_indices tuple[int, ...] | None

Integer indices (alternative to labels).

None
piecewise_steps_multiplier int

Subdivision factor. Defaults to 1.

1
optimization_rate float

Step length. Defaults to 0.01.

0.01
max_optimization_steps int

Maximum iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance. Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
tuple[bool, int]

A tuple (success, iters).

length(parameter_labels=None, parameter_indices=None, piecewise_steps_multiplier=1, optimization_rate=0.01, max_optimization_steps=100, diff_tol=0.1, callbacks=None) ¤

Minimise the total pulse length.

Cost (PulseLength): \(\sum_g\sqrt{\sum_{k\in P}\phi_k(g)^2 + \|d_g\|^2}\) where \(d_g\) is the per-segment drift contribution.

Parameters:

Name Type Description Default
parameter_labels list[str] | None

Projected-basis labels to minimise. If None, all projected parameters are used.

None
parameter_indices tuple[int, ...] | None

Integer indices (alternative to labels).

None
piecewise_steps_multiplier int

Subdivision factor. Defaults to 1.

1
optimization_rate float

Step length. Defaults to 0.01.

0.01
max_optimization_steps int

Maximum iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance. Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
tuple[bool, int]

A tuple (success, iters).

robust(parameter_labels=None, parameter_indices=None, delta=0.01, num_samples=5, piecewise_steps_multiplier=1, optimization_rate=0.01, max_optimization_steps=100, diff_tol=0.1, callbacks=None) ¤

Maximise the worst-case fidelity over \(\delta\) perturbations.

Cost (Robustness): \(1 - \min_{\boldsymbol\delta} F(U(\phi+\sum_k \delta_k e_k))\) over a Cartesian grid of num_samples evenly-spaced values in \([-\delta, +\delta]\) for each \(k\in P\).

Parameters:

Name Type Description Default
parameter_labels list[str] | None

Projected-basis labels to make robust.

None
parameter_indices tuple[int, ...] | None

Integer indices (alternative to labels).

None
delta float

Half-width of the perturbation box. Defaults to 0.01.

0.01
num_samples int

Samples per parameter. Defaults to 5.

5
piecewise_steps_multiplier int

Subdivision factor. Defaults to 1.

1
optimization_rate float

Step length. Defaults to 0.01.

0.01
max_optimization_steps int

Maximum iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance. Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
tuple[bool, int]

A tuple (success, iters).

bound(parameter_bounds, method='projected_gradient', bounding_rate=0.01, max_bounding_steps=100, diff_tol=0.1, callbacks=None) ¤

Enforce parameter bounds via null-space optimisation.

Moves the parameters toward the feasible box defined by parameter_bounds while staying in the Jacobian null space.

Parameters:

Name Type Description Default
parameter_bounds dict[str, tuple[float, float]]

In projected space, a dictionary mapping interaction labels to (min, max) tuples. In experimental space (param_transform set), a dictionary mapping integer parameter indices to (min, max) tuples — the same index convention pulse_constraints uses there; unbounded parameters default to (-inf, inf).

required
method str

Bounding strategy — 'projected_gradient' / 'pg' minimises the worst violation (BoundViolation); 'mid_point' / 'mp' pulls bounded parameters toward the centre of their box (BoundMidpoint). Defaults to 'projected_gradient'.

'projected_gradient'
bounding_rate float

Step length. Defaults to 0.01.

0.01
max_bounding_steps int

Maximum iterations. Defaults to 100.

100
diff_tol float

Convergence tolerance. Defaults to 0.1.

0.1
callbacks Callable | list[Callable] | tuple[Callable, ...] | None

Optional callback(s) callback(step, history, gecko) run at the end of every iteration; a falsy return stops the loop. See :meth:_null_space_optimisation.

None

Returns:

Type Description
bool

A tuple (success, iters) where success is True if

int

diff_tol was reached.

Raises:

Type Description
ValueError

If an unsupported method is provided, or if a label-keyed dict is passed under param_transform.

get_free_params_update_smoothing() ¤

Build a JIT-compiled function to reconstruct free parameters.

Combines projected and drift parameters into the full free-parameter array during smoothing.

Returns:

Type Description
Callable[[Array, ndarray], Array]

A JIT-compiled callable

Callable[[Array, ndarray], Array]

update_free_params_smoothing(proj_params, params).

geope.objectives¤

geope.objectives ¤

Composable null-space objectives for :class:geope.Gecko.

An objective is a scalar cost of the projected pulse that Gecko lowers while moving only inside the Jacobian null space, so that fidelity is preserved to first order. Objectives are values, not procedures: each is a @dataclass(frozen=True) spec (value __eq__ and __repr__ for free, like the line searches) that knows how to turn itself into a cost function, and nothing about how that cost is minimised. The minimiser is Gecko's one projected-gradient step, which is what lets objectives be added together.

Weighted sums. Objectives combine linearly with *, + and -::

objective = 1.0 * Smoothness() + 0.1 * PeakAmplitude(parameter_labels=["XI"])
gecko.optimize(objective)

which builds a :class:WeightedSum whose cost is the raw linear combination \(C(\phi) = \sum_i w_i c_i(\phi)\). Nested sums flatten, a scalar distributes over a sum, and the builtin sum works (sum([a, b])). Because Gecko takes a fixed-length step along the null-space projection of \(\nabla C\), only the ratios of the weights shape the trajectory; their overall scale changes only what diff_tol means. A zero weight is allowed and useful: the term is still evaluated and reported in gecko.costs but contributes no gradient (its input is wrapped in stop_gradient, so its backward pass is never traced). A negative weight is allowed too and maximises that term.

The build contract. objective.build(params) -> cost resolves the spec against a :class:~geope.Parameters (labels to indices, bounds to arrays, the drift norm, the fidelity) and returns cost(phi), where phi is the real float64 projected pulse of shape (N_g, K_P) — K_P is the projected basis dimension, or n_experimental_params under param_transform — and the result is a real scalar. The cost must be traceable and differentiable almost everywhere. Gecko builds an objective after any subdivision, so a cost may close over the subdivided params.delta_t; every cost here is otherwise independent of piecewise_steps. Subclass :class:Objective (or wrap a function in :class:CustomObjective) to add a new one.

TYPE_CHECKING module-attribute ¤

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

__cached__ module-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__doc__ module-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__file__ module-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__name__ module-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__package__ module-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

annotations module-attribute ¤
Objective ¤

Base class for a null-space objective.

Subclasses are @dataclass(frozen=True) specs that set the class attribute name (the key the term is reported under in gecko.costs) and implement :meth:build. Multiplying by a scalar or adding another objective gives a :class:WeightedSum.

__dict__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__weakref__ property ¤

list of weak references to the object

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

build(params) ¤

Resolve the spec against params and return its cost function.

Parameters:

Name Type Description Default
params Parameters

The Parameters whose pulse is being post-processed, already subdivided.

required

Returns:

Type Description
Callable[[Array], Array]

A callable cost(phi) mapping the real (N_g, K_P) projected

Callable[[Array], Array]

pulse to a real scalar.

__mul__(weight) ¤
__rmul__(weight) ¤
__add__(other) ¤
__radd__(other) ¤
__neg__() ¤
__sub__(other) ¤
WeightedSum ¤

A linear combination \(\sum_i w_i c_i\) of objectives.

Usually built with * and + rather than directly. Nested sums are flattened on construction, so terms holds only plain objectives.

Attributes:

Name Type Description
terms

((weight, objective), ...); weights are coerced to finite float.

Raises:

Type Description
TypeError

If a term is not a (weight, objective) pair or a weight is not a real number.

ValueError

If there are no terms or a weight is not finite.

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__dict__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__weakref__ property ¤

list of weak references to the object

label property ¤

A readable formula, e.g. smoothness + 0.1·peak_amplitude.

names property ¤

Each term's name, de-duplicated as name, name_2, ....

__post_init__() ¤
build(params) ¤

Build every term and return the combined cost.

This is the single place where terms are combined.

Parameters:

Name Type Description Default
params Parameters

The Parameters whose pulse is being post-processed, already subdivided.

required

Returns:

Type Description
Callable[[Array], tuple[Array, Array]]

A callable cost(phi) -> (total, values): total is

Callable[[Array], tuple[Array, Array]]

\(\sum_i w_i c_i(\phi)\) and values the (n_terms,) array of the

Callable[[Array], tuple[Array, Array]]

unweighted \(c_i(\phi)\). Zero-weight terms are evaluated on a

Callable[[Array], tuple[Array, Array]]

stop_gradient-ed pulse, so they report without contributing.

__add__(other) ¤
__radd__(other) ¤
__mul__(weight) ¤
__rmul__(weight) ¤
__neg__() ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(terms) ¤
__repr__() ¤
__setattr__(name, value) ¤
Smoothness ¤

Penalise jumps between consecutive segments, with zero endpoints.

Cost: \(\|\phi_0\|^2 + \sum_g \|\phi_{g+1} - \phi_g\|^2 + \|\phi_{N_g-1}\|^2\) — the squared differences of the pulse padded with a zero segment at each end, so a pulse that switches on or off abruptly is penalised too.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__() ¤
__repr__() ¤
__setattr__(name, value) ¤
SpectralPower ¤

Penalise high-frequency spectral power.

Cost: \(\frac{1}{(N_r-1)K}\sum_{m \ge 1, k}|\widehat{\phi_k}(m)|^2\) over the \(N_r\) bins of the rfft along time. The DC bin \(m=0\) is excluded so the mean level of each pulse is not penalised (a single segment has no other bin, and costs 0).

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__() ¤
__repr__() ¤
__setattr__(name, value) ¤
FrequencyFilter ¤

Drive the pulse toward a filtered version of itself.

Cost: \(\mathrm{mean}\,|\widehat\phi - \mathcal F(\widehat\phi)|^2\), the squared Fourier-space distance to the filtered spectrum — by Parseval, the time-domain \(L^2\) distance up to a constant.

Attributes:

Name Type Description
filter_fn

Maps the complex (N_r, K) rfft of the pulse to a same-shape filtered spectrum.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(filter_fn) ¤
__repr__() ¤
__setattr__(name, value) ¤
PeakAmplitude ¤

Minimise the peak amplitude of selected parameters.

Cost: \(\max_{g,k\in P}|\phi_{g,k}|\). Lowering it raises the gate-speed limit.

Attributes:

Name Type Description
parameter_labels

Projected-basis labels \(P\) (not under param_transform).

parameter_indices

Column indices \(P\), the alternative to labels. One of the two is required.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__post_init__() ¤
build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(parameter_labels=None, parameter_indices=None) ¤
__repr__() ¤
__setattr__(name, value) ¤
PulseLength ¤

Minimise the total pulse length.

Cost: \(\sum_g\sqrt{\sum_{k\in P}\phi_{g,k}^2 + \|d\|^2 + \varepsilon}\), where \(d\) is the per-segment drift (zero under param_transform).

Attributes:

Name Type Description
parameter_labels

Projected-basis labels \(P\) (not under param_transform).

parameter_indices

Column indices \(P\), the alternative to labels. With neither, every column is used.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__post_init__() ¤
build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(parameter_labels=None, parameter_indices=None) ¤
__repr__() ¤
__setattr__(name, value) ¤
Robustness ¤

Maximise the worst-case fidelity under uniform parameter offsets.

Cost: \(1 - \min_{\boldsymbol\delta} F\bigl(U(\phi + \sum_{k\in P}\delta_k e_k)\bigr)\) over a Cartesian grid of num_samples evenly spaced values in \([-\Delta, \Delta]\) per parameter in \(P\); each \(\delta_k\) is applied to every segment. Costs num_samples ** len(P) fidelity evaluations.

Attributes:

Name Type Description
parameter_labels

Projected-basis labels \(P\) (not under param_transform).

parameter_indices

Column indices \(P\), the alternative to labels. One of the two is required.

delta

Half-width \(\Delta\) of the perturbation box.

num_samples

Samples per parameter.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

delta class-attribute ¤

Convert a string or number to a floating point number, if possible.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

num_samples class-attribute ¤

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

__post_init__() ¤
build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(parameter_labels=None, parameter_indices=None, delta=0.01, num_samples=5) ¤
__repr__() ¤
__setattr__(name, value) ¤
BoundViolation ¤

Penalise the worst violation of a box constraint.

Cost: \(\max_{g,k}\bigl(\max(\phi_{g,k} - u_k, 0) + \max(l_k - \phi_{g,k}, 0)\bigr)\) — zero once every parameter is inside its bounds.

Attributes:

Name Type Description
bounds

In projected space, {label: (min, max)}; under param_transform, {index: (min, max)} (the pulse_constraints convention). Unlisted columns are unbounded. Stored as a tuple of pairs, so the spec stays immutable.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__post_init__() ¤
build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(bounds) ¤
__repr__() ¤
__setattr__(name, value) ¤
BoundMidpoint ¤

Pull bounded parameters toward the centre of their box.

Cost: \(\sum_{g,\,k \text{ bounded}} \bigl((\phi_{g,k} - m_k)/\hat r_k \bigr)^2\), with midpoint \(m_k = (l_k + u_k)/2\) and range \(r_k = u_k - l_k\) normalised by the largest, \(\hat r_k = r_k/\max_j r_j\). Only columns with both bounds finite take part; a pinned column (\(l_k = u_k\)) uses \(\hat r_k = 1\).

Attributes:

Name Type Description
bounds

As for :class:BoundViolation.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__post_init__() ¤
build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(bounds) ¤
__repr__() ¤
__setattr__(name, value) ¤
CustomObjective ¤

Wrap a user cost function as an objective.

Attributes:

Name Type Description
fn

fn(phi) -> scalar on the real (N_g, K_P) projected pulse; must be traceable and differentiable almost everywhere.

name

Key the term is reported under in gecko.costs.

__dict__ class-attribute ¤
__weakref__ property ¤

list of weak references to the object

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_params__ class-attribute ¤
__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

name class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

build(params) ¤
__add__(other) ¤
__mul__(weight) ¤
__neg__() ¤
__radd__(other) ¤
__rmul__(weight) ¤
__sub__(other) ¤
__delattr__(name) ¤
__eq__(other) ¤
__hash__() ¤
__init__(fn, name='custom') ¤
__repr__() ¤
__setattr__(name, value) ¤
as_weighted_sum(objective) ¤

Wrap a bare Objective as 1.0 * objective; pass a sum through.

Raises:

Type Description
TypeError

If objective is neither.

resolve_parameter_indices(params, parameter_labels, parameter_indices, default_all=False) ¤

Resolve parameter_labels / parameter_indices into column indices.

Parameters:

Name Type Description Default
params Parameters

The Parameters the indices refer to.

required
parameter_labels tuple[str, ...] | None

Optional projected-basis label strings.

required
parameter_indices tuple[int, ...] | None

Optional integer indices into the projected pulse's columns.

required
default_all bool

If both are None and this is True, return every column.

False

Returns:

Type Description
tuple[int, ...]

A tuple of integer indices into the projected pulse's columns.

Raises:

Type Description
ValueError

If both are provided, if neither is and default_all is False, or if labels are passed with param_transform active.

resolve_bounds(params, bounds) ¤

Resolve a bounds map into per-column (K_P,) lower and upper bounds.

The bounds are constant in time, so they are returned per column and broadcast over the gates by the costs — which keeps them valid across a subdivision.

Parameters:

Name Type Description Default
params Parameters

The Parameters the bounds refer to.

required
bounds tuple

In projected space, a mapping (or iterable of pairs) from interaction labels to (min, max); under param_transform, from integer experimental-parameter indices. Unlisted columns are unbounded.

required

Returns:

Type Description
tuple[ndarray, ndarray]

(lower, upper), float arrays of shape (K_P,).

Raises:

Type Description
ValueError

If label keys are passed under param_transform.