Line Generator

class scanpointgenerator.LineGenerator(name, units, start, stop, num, alternate_direction=False)[source]

Generate a line of equally spaced N-dimensional points

Parameters:
  • name (str/list(str) – The scannable name(s) E.g. “x” or [“x”, “y”]
  • units (str) – The scannable units. E.g. “mm”
  • start (float/list(float) – The first position to be generated. e.g. 1.0 or [1.0, 2.0]
  • stop (float or list(float) – The first position to be generated. e.g. 5.0 or [5.0, 10.0]
  • num (int) – The number of points to generate. E.g. 5
  • alternate_direction (bool) – Specifier to reverse direction if generator is nested
to_dict()[source]

Convert object attributes into a dictionary

classmethod from_dict(d)[source]

Create a LineGenerator instance from a serialised dictionary

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

Examples

This example defines a motor “x” with engineering units “mm” which is being scanned from 0mm to 1mm with 5 scan points inclusive of the start. Note that the capture points are as given, so the bounds will be +-0.5*step of each capture point.

from scanpointgenerator import LineGenerator, plot_generator

gen = LineGenerator("x", "mm", 0.0, 1.0, 5)
plot_generator(gen)

(Source code)

LineGenerator is N dimensional; just pass in ND lists for name, start and stop.

from scanpointgenerator import LineGenerator, plot_generator

gen = LineGenerator(["x", "y"], "mm", [1.0, 2.0], [5.0, 10.0], 5)
plot_generator(gen)

(Source code)