Architecture¶
Every scan point generator inherits from the ScanPointGenerator baseclass. This baseclass provides the following API:
-
class
scanpointgenerator.
Generator
[source]¶ Base class for all malcolm scan point generators
Variables: - position_units (dict) – Dict of str position_name -> str position_unit for each scannable dimension. E.g. {“x”: “mm”, “y”: “mm”}
- index_dims (list) – List of the int dimension sizes for the dataset. This will have the same length as the position_units list for square scans but will be shorter for things like spiral scans. E.g. [15]
- index_names (list) – List of the str dimension names for the dataset. This will have the same length as the index_dims. E.g. [“spiral_i”]
- axes (list) – List of scannable names, used in GDA to reconstruct Point in CompoundGenerators
-
iterator
()[source]¶ An iterator yielding positions at each scan point
Yields: Point – The next scan Point
Each point produced by the iterator represents a scan point, with the following API:
-
class
scanpointgenerator.
Point
[source]¶ Contains information about for each scan point
Variables: - positions (dict) – Dict of str position_name -> float position for each scannable dimension. E.g. {“x”: 0.1, “y”: 2.2}
- lower (dict) – Dict of str position_name -> float lower_bound for each scannable dimension. E.g. {“x”: 0.95, “y”: 2.15}
- upper (dict) – Dict of str position_name -> float upper_bound for each scannable dimension. E.g. {“x”: 1.05, “y”: 2.25}
- indexes (list) – List of int indexes for each dataset dimension, fastest changing last. E.g. [15]
- duration (int) – Int or None for duration of the point exposure
Using the API¶
You would use a generator in a step scan like this:
>>> for point in generator.iterator():
>>> for mname, mpos in point.positions():
>>> motors[mname].move(mpos)
>>> det.write_data_to_index(point.indexes)