3.6.11. qupulse.pulses.parameters

This module defines parameter constriants.

Classes

ParameterConstrainer(*, parameter_constraints)

A class that implements the testing of parameter constraints.

ParameterConstraint(relation)

A parameter constraint like 't_2 < 2.7' that can be used to set bounds to parameters.

Exceptions

ConstrainedParameterIsVolatileWarning(...)

InvalidParameterNameException(parameter_name)

ParameterConstraintViolation(constraint, ...)

exception ConstrainedParameterIsVolatileWarning(parameter_name: str, constraint: ParameterConstraint)[source]

Bases: RuntimeWarning

property constraint: ParameterConstraint
property parameter_name: str
class ParameterConstrainer(*, parameter_constraints: Iterable[Expr | str | ParameterConstraint] | None)[source]

Bases: object

A class that implements the testing of parameter constraints. It is used by the subclassing pulse templates.

property constrained_parameters: AbstractSet[str]
property parameter_constraints: List[ParameterConstraint]
validate_parameter_constraints(parameters: [<class 'str'>, <class 'numbers.Real'>], volatile: ~typing.Set[str]) None[source]

Raises a ParameterConstraintViolation exception if one of the constraints is violated.

Parameters:
  • parameters – These parameters are checked.

  • volatile – For each of these parameters a warning is raised if they appear in a constraint

Raises:

ParameterConstraintViolation – if one of the constraints is violated.

Warning

ConstrainedParameterIsVolatileWarning: via ParameterConstraint.is_fulfilled

validate_scope(scope: Scope)[source]
class ParameterConstraint(relation: str | Expr)[source]

Bases: AnonymousSerializable

A parameter constraint like ‘t_2 < 2.7’ that can be used to set bounds to parameters.

property affected_parameters: Set[str]
get_serialization_data() str[source]

Return all data relevant for serialization as a JSON compatible type that is accepted as constructor argument

Returns:

A JSON compatible type that can be used to construct an equal object.

is_fulfilled(parameters: Mapping[str, Any], volatile: AbstractSet[str] = frozenset({})) bool[source]
Parameters:
  • parameters – These parameters are checked.

  • volatile – For each of these parameters a warning is raised if they appear in a constraint

Raises:

qupulse.parameter_scope.ParameterNotProvidedException – if a parameter is missing

Warning

ConstrainedParameterIsVolatileWarning: if a constrained parameter is volatile

property sympified_expression: Expr
exception ParameterConstraintViolation(constraint: ParameterConstraint, parameters: Dict[str, Real])[source]

Bases: Exception

exception ParameterNotProvidedException(parameter_name: str)[source]

Bases: KeyError

Indicates that a required parameter value was not provided.

property parameter_name