3.3. qupulse.parameter_scope¶
Contains various implementations of the parameter lookup interface Scope
Classes
|
|
|
|
|
|
|
Abstract parameter lookup. Scopes are immutable. Internally it holds all dependencies of parameters and keeps |
Exceptions
Raised if a non volatile parameter is updated |
|
|
Indicates that a required parameter value was not provided. |
- class DictScope(values: Mapping[str, Number], volatile: AbstractSet[str] = frozenset({}))[source]¶
Bases:
Scope- change_constants(new_constants: Mapping[str, Number]) 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: Number) DictScope[source]¶
- classmethod from_mapping(mapping: Mapping[str, Number], volatile: AbstractSet[str] = frozenset({})) DictScope[source]¶
- get_parameter(parameter_name) Number[source]¶
- Parameters:
parameter_name
- Raises:
ParameterNotProvidedException if the parameter is not provided by this scope –
- Returns:
Parameter value
- get_volatile_parameters() Mapping[str, Expression][source]¶
- Returns:
A mapping where the keys are the volatile parameters and the
- items¶
- keys¶
- values¶
- class JointScope(lookup: Mapping[str, Scope])[source]¶
Bases:
Scope- change_constants(new_constants: Mapping[str, Number]) 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) Number[source]¶
- Parameters:
parameter_name
- Raises:
ParameterNotProvidedException if the parameter is not provided by this scope –
- Returns:
Parameter value
- get_volatile_parameters() Mapping[str, Expression][source]¶
- Returns:
A mapping where the keys are the volatile parameters and the
- class MappedScope(scope: Scope, mapping: Mapping[str, Expression])[source]¶
Bases:
Scope- change_constants(new_constants: Mapping[str, Number]) 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) Number[source]¶
- Parameters:
parameter_name
- Raises:
ParameterNotProvidedException if the parameter is not provided by this scope –
- Returns:
Parameter value
- get_volatile_parameters() Mapping[str, Expression][source]¶
- Returns:
A mapping where the keys are the volatile parameters and the
- exception NonVolatileChange[source]¶
Bases:
RuntimeWarningRaised if a non volatile parameter is updated
- exception ParameterNotProvidedException(parameter_name: str)[source]¶
Bases:
KeyErrorIndicates that a required parameter value was not provided.
- property parameter_name¶
- class Scope[source]¶
-
- 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()- abstractmethod change_constants(new_constants: Mapping[str, Number]) 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
- abstractmethod get_parameter(parameter_name: str) Number[source]¶
- Parameters:
parameter_name
- Raises:
ParameterNotProvidedException if the parameter is not provided by this scope –
- Returns:
Parameter value
- abstractmethod get_volatile_parameters() Mapping[str, Expression][source]¶
- Returns:
A mapping where the keys are the volatile parameters and the