3.4. qupulse.parameter_scope

Contains various implementations of the parameter lookup interface Scope

Classes

DictScope(values[, volatile])

JointScope(lookup)

MappedScope(scope, mapping)

Scope()

Abstract parameter lookup. Scopes are immutable. Internally it holds all dependencies of parameters and keeps

Exceptions

NonVolatileChange

Raised if a non volatile parameter is updated

ParameterNotProvidedException(parameter_name)

Indicates that a required parameter value was not provided.

class qupulse.parameter_scope.DictScope(values: Mapping[str, numbers.Number], volatile: AbstractSet[str] = frozenset({}))[source]

Bases: qupulse.parameter_scope.Scope

change_constants(new_constants: Mapping[str, numbers.Number]) qupulse.parameter_scope.Scope[source]

Change values of constants. Constants not present in the scope are ignored.

Parameters

new_constants

Warning

NonVolatileChange: if a parameter that is not in get_volatile_parameters is updated

Returns

New scope instance

classmethod from_kwargs(*, volatile: AbstractSet[str] = frozenset({}), **kwargs: numbers.Number) qupulse.parameter_scope.DictScope[source]
classmethod from_mapping(mapping: Mapping[str, numbers.Number], volatile: AbstractSet[str] = frozenset({})) qupulse.parameter_scope.DictScope[source]
get_parameter(parameter_name) numbers.Number[source]
Parameters

parameter_name

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Returns

Parameter value

get_volatile_parameters() Mapping[str, qupulse.expressions.sympy.Expression][source]
Returns

A mapping where the keys are the volatile parameters and the

items
keys
values
class qupulse.parameter_scope.JointScope(lookup: Mapping[str, qupulse.parameter_scope.Scope])[source]

Bases: qupulse.parameter_scope.Scope

change_constants(new_constants: Mapping[str, numbers.Number]) qupulse.parameter_scope.JointScope[source]

Change values of constants. Constants not present in the scope are ignored.

Parameters

new_constants

Warning

NonVolatileChange: if a parameter that is not in get_volatile_parameters is updated

Returns

New scope instance

get_parameter(parameter_name: str) numbers.Number[source]
Parameters

parameter_name

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Returns

Parameter value

get_volatile_parameters() Mapping[str, qupulse.expressions.sympy.Expression][source]
Returns

A mapping where the keys are the volatile parameters and the

class qupulse.parameter_scope.MappedScope(scope: qupulse.parameter_scope.Scope, mapping: Mapping[str, qupulse.expressions.sympy.Expression])[source]

Bases: qupulse.parameter_scope.Scope

as_dict() Mapping[str, numbers.Number][source]
change_constants(new_constants: Mapping[str, numbers.Number]) qupulse.parameter_scope.MappedScope[source]

Change values of constants. Constants not present in the scope are ignored.

Parameters

new_constants

Warning

NonVolatileChange: if a parameter that is not in get_volatile_parameters is updated

Returns

New scope instance

get_parameter(parameter_name: str) numbers.Number[source]
Parameters

parameter_name

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Returns

Parameter value

get_volatile_parameters() Mapping[str, qupulse.expressions.sympy.Expression][source]
Returns

A mapping where the keys are the volatile parameters and the

items() a set-like object providing a view on D's items[source]
keys() a set-like object providing a view on D's keys[source]
values() an object providing a view on D's values[source]
exception qupulse.parameter_scope.NonVolatileChange[source]

Bases: RuntimeWarning

Raised if a non volatile parameter is updated

exception qupulse.parameter_scope.ParameterNotProvidedException(parameter_name: str)[source]

Bases: KeyError

Indicates that a required parameter value was not provided.

property parameter_name
class qupulse.parameter_scope.Scope[source]

Bases: Mapping[str, numbers.Number]

Abstract parameter lookup. Scopes are immutable. Internally it holds all dependencies of parameters and keeps

track which had been marked as volatile. This allows creating a new scope with different volatile dependencies.

Parameter: A key, value pair in this Mapping Constant: A Volatile constant:

Equality: Scopes may not be equal even if type and abstract properties are equal. If you need semantic equality use Scope.as_dict()

as_dict() Mapping[str, numbers.Number][source]
abstract change_constants(new_constants: Mapping[str, numbers.Number]) qupulse.parameter_scope.Scope[source]

Change values of constants. Constants not present in the scope are ignored.

Parameters

new_constants

Warning

NonVolatileChange: if a parameter that is not in get_volatile_parameters is updated

Returns

New scope instance

abstract get_parameter(parameter_name: str) numbers.Number[source]
Parameters

parameter_name

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Returns

Parameter value

abstract get_volatile_parameters() Mapping[str, qupulse.expressions.sympy.Expression][source]
Returns

A mapping where the keys are the volatile parameters and the

overwrite(to_overwrite: Mapping[str, numbers.Number]) qupulse.parameter_scope.Scope[source]