3.5. qupulse.parameter_scope

Contains various implementations of the parameter lookup interface Scope

class qupulse.parameter_scope.DictScope(values, volatile=frozenset({}))[source]

Bases: qupulse.parameter_scope.Scope

change_constants(new_constants)[source]

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

Parameters

new_constants (Mapping[str, Number]) –

Warning

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

Return type

Scope

Returns

New scope instance

classmethod from_kwargs(*, volatile=frozenset({}), **kwargs)[source]
Return type

DictScope

classmethod from_mapping(mapping, volatile=frozenset({}))[source]
Return type

DictScope

get_parameter(parameter_name)[source]
Parameters

parameter_name

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Return type

Number

Returns

Parameter value

get_volatile_parameters()[source]

Returns: A mapping where the keys are the volatile parameters and the

Return type

_FrozenDictByWrapping[str, Expression]

items
keys
values
class qupulse.parameter_scope.JointScope(lookup)[source]

Bases: qupulse.parameter_scope.Scope

change_constants(new_constants)[source]

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

Parameters

new_constants (Mapping[str, Number]) –

Warning

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

Return type

JointScope

Returns

New scope instance

get_parameter(parameter_name)[source]
Parameters

parameter_name (str) –

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Return type

Number

Returns

Parameter value

get_volatile_parameters()[source]

Returns: A mapping where the keys are the volatile parameters and the

Return type

_FrozenDictByWrapping[str, Expression]

class qupulse.parameter_scope.MappedScope(scope, mapping)[source]

Bases: qupulse.parameter_scope.Scope

as_dict()[source]
Return type

_FrozenDictByWrapping[str, Number]

change_constants(new_constants)[source]

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

Parameters

new_constants (Mapping[str, Number]) –

Warning

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

Return type

MappedScope

Returns

New scope instance

get_parameter(parameter_name)[source]
Parameters

parameter_name (str) –

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Return type

Number

Returns

Parameter value

get_volatile_parameters()[source]

Returns: A mapping where the keys are the volatile parameters and the

Return type

AbstractSet[str]

items()[source]
Return type

AbstractSet[Tuple[str, Number]]

keys()[source]
Return type

AbstractSet[str]

values()[source]
Return type

ValuesView[Number]

exception qupulse.parameter_scope.NonVolatileChange[source]

Bases: RuntimeWarning

Raised if a non volatile parameter is updated

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

Bases: KeyError

Indicates that a required parameter value was not provided.

property parameter_name
class qupulse.parameter_scope.Scope[source]

Bases: collections.abc.Mapping, typing.Generic

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()[source]
Return type

_FrozenDictByWrapping[str, Number]

abstract change_constants(new_constants)[source]

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

Parameters

new_constants (Mapping[str, Number]) –

Warning

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

Return type

Scope

Returns

New scope instance

abstract get_parameter(parameter_name)[source]
Parameters

parameter_name (str) –

Raises

ParameterNotProvidedException if the parameter is not provided by this scope

Return type

Number

Returns

Parameter value

abstract get_volatile_parameters()[source]
Return type

_FrozenDictByWrapping[str, Expression]

Returns

A mapping where the keys are the volatile parameters and the

overwrite(to_overwrite)[source]
Return type

Scope