Array Generator

class scanpointgenerator.ArrayGenerator(name, units, points, lower_bounds=None, upper_bounds=None)[source]

Generate a given n-dimensional array of points

Parameters:
  • name (str/list(str) – ND list of scannable names e.g. “x” or [“x”, “y”]
  • units (str) – The scannable units. E.g. “mm”
  • points (list) – List of ND lists of coordinates e.g. [1.0, 2.0, 3.0] or [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]
  • lower_bounds (list) – List of ND lists of lower bound coordinates
  • upper_bounds (list) – List of ND lists of upper bound coordinates
to_dict()[source]

Convert object attributes into a dictionary

classmethod from_dict(d)[source]

Create a ArrayGenerator instance from a serialised dictionary

Parameters:d (dict) – Dictionary of attributes
Returns:New ArrayGenerator instance
Return type:ArrayGenerator

Examples

The ArrayGenerator takes an N-Dimensional array of coordinates and creates Points with calculated upper and lower bounds. You can also provide your own bounds.

from scanpointgenerator import ArrayGenerator, plot_generator

points = [0.0, 2.0, 3.0, 5.0, 7.0, 8.0]
array = ArrayGenerator("x", "mm", points)
plot_generator(array)

(Source code)

And a 2D scan.

from scanpointgenerator import ArrayGenerator, plot_generator

points = [[0.0, 2.0], [2.0, 3.0], [3.0, 5.0], [5.0, 6.0], [7.0, 7.0], [8.0, 9.0]]
array = ArrayGenerator(["x", "y"], "mm", points)
plot_generator(array)

(Source code)