calix.common.base
Provides abstract base classes for calibrations and algorithms.
Classes
|
Helper class that provides a standard way to create an ABC using inheritance. |
Base class for calibration Algorithms. |
|
|
Base class for calibration applications. |
Data structure for collecting other configuration parameters for higher-level calibration functions. |
|
|
Data structure for higher-level calibration results, that combine multiple parameters into a logal unit. |
Data structure for collecting targets for higher-level calibration functions into one logical unit. |
|
|
Data structure for calibration results of single parameters. |
|
|
|
|
|
|
Functions
-
calix.common.base.
abstractmethod
(funcobj) A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A class that has a metaclass derived from ABCMeta cannot be instantiated unless all of its abstract methods are overridden. The abstract methods can be called using any of the normal ‘super’ call mechanisms. abstractmethod() may be used to declare abstract methods for properties and descriptors.
Usage:
- class C(metaclass=ABCMeta):
@abstractmethod def my_abstract_method(self, …):
…
-
calix.common.base.
check_range_boundaries
(parameters: np.ndarray, boundaries: ParameterRange, errors: Optional[List[str]] = None) → BoundaryCheckResult Checks if parameters are in a given range and sets them to the limits if they exceed the range. If error messages are given, returns those if a parameter has reached the limits or has gone beyond.
- Parameters
parameters – Array of parameters to check.
boundaries – Parameter range to be checked for.
errors – List of error messages to print when parameter exceeds respective boundaries, in format [err_lower, err_upper]. Message needs to include placeholer ‘{0}’ where indices of the violating parameters are inserted.
- Returns
BoundaryCheckResult, containing parameters within boundaries, error mask and optional error messages.
-
calix.common.base.
dataclass
(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False) Returns the same class as was passed in, with dunder methods added based on the fields defined in the class.
Examines PEP 526 __annotations__ to determine fields.
If init is true, an __init__() method is added to the class. If repr is true, a __repr__() method is added. If order is true, rich comparison dunder methods are added. If unsafe_hash is true, a __hash__() method function is added. If frozen is true, fields may not be assigned to after instance creation.
-
calix.common.base.
namedtuple
(typename, field_names, *, rename=False, defaults=None, module=None) Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessible by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22)
-
calix.common.base.
run
(connection: calix.common.base.StatefulConnection, builder: calix.common.base.WriteRecordingPlaybackProgramBuilder) → pystadls_vx_v3.PlaybackProgram Wraps the stadls run function.
Records all write accesses and updates the connection’s reinit program.
Includes a barrier, blocking for the omnibus being idle, before the end of the program. The finished program is returned, such that, e.g., spikes are accessible.
- Parameters
connection – Connection to the chip to execute on.
builder – Builder to execute.
- Returns
Program compiled by builder.done() that is executed.