Source code for atomiq.parameter_space
"""Sources of per-point scan values.
A parameter space source enumerates the points of a scan. It provides only the values of the active scan axes. The
constant and computed parts of a point are added by the experiment.
"""
from typing import Protocol
from artiq.language.scan import MultiScanManager
[docs]
class ParameterSpaceSource(Protocol):
"""Interface of a source of scanned point values.
The schema is fixed before the source yields its first point. A consumer pairs it with every tuple that
``__iter__`` yields to recover the argument names. The ``schema`` attribute holds the ordered ``(name, type)``
pairs of the scanned arguments.
"""
schema: list[tuple[str, type]]
[docs]
def __iter__(self):
"""Yield one tuple of scanned values per point, in schema order."""
...
[docs]
class MultiScanSource:
"""Parameter space source that wraps an ARTIQ ``MultiScanManager``.
Args:
mult_scan: Scan manager that enumerates the scan axes of the run.
schema: Ordered ``(name, type)`` pairs. The value of each name is read from the points of the scan manager.
"""
def __init__(self, mult_scan: MultiScanManager, schema: list[tuple[str, type]]):
self.mult_scan = mult_scan
self.schema = schema
[docs]
def __iter__(self):
"""Yield one tuple of scanned values per point, in schema order."""
for point in self.mult_scan:
yield tuple(getattr(point, name) for name, _ in self.schema)