Array Generator

class scanpointgenerator.ArrayGenerator(axis, units, points, alternate=False)[source]

Generate points fron a given list of positions

Parameters:
  • axis (str) – The scannable axis name
  • units (str) – The scannable units.
  • points (list(double)) – array positions
  • alternate (bool) – Alternate directions
prepare_arrays(index_array)[source]

Abstract method to create position or bounds array from provided index array. index_array will be np.arange(self.size) for positions and np.arange(self.size + 1) - 0.5 for bounds.

Parameters:index_array (np.array) – Index array to produce parameterised points
Returns:Dictionary of axis names to position/bounds arrays
Return type:Positions
to_dict()[source]

Serialize ArrayGenerator to dictionary

classmethod from_dict(d)[source]

Create a ArrayGenerator from serialized form.

Parameters:d (dict) – Serialized generator
Returns:New ArrayGenerator instance
Return type:ArrayGenerator

Examples

This example defines a motor “x” with units “mm” which is being scanned over the series of positions [0, 1, 1.5, 1.8, 2, 2.1, 2.25, 3]

from scanpointgenerator import ArrayGenerator
from scanpointgenerator.plotgenerator import plot_generator

positions = [0, 1, 1.5, 1.8, 2, 2.1, 2.25, 3]
gen = ArrayGenerator("x", "mm", positions)
plot_generator(gen)

(Source code, png, hires.png, pdf)

_images/arraygenerator-1.png