Lissajous Generator¶
-
class
scanpointgenerator.
LissajousGenerator
(axes, units, centre, span, lobes, size=None, alternate=False)[source]¶ Generate the points of a Lissajous curve
Parameters: - axes (list(str)) – The scannable axes e.g. [“x”, “y”]
- units (list(str)) – The scannable units e.g. [“mm”, “mm”]
- centre (list(float)) – The centre of the lissajous curve
- span (list(float)) – The [height, width] of the curve
- num (int) – Number of x-direction lobes for curve; will have lobes+1 y-direction lobes
- size (int) – The number of points to fill the Lissajous curve. Default is 250 * lobes
-
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
-
classmethod
from_dict
(d)[source]¶ Create a LissajousGenerator instance from a serialised dictionary
Parameters: d (dict) – Dictionary of attributes Returns: New LissajousGenerator instance Return type: LissajousGenerator
Examples¶
This example defines motors “x” and “y” with engineering units “mm” which will be scanned over a 3x4 lobe Lissajous curve with filling a 1x1mm rectangle.
from scanpointgenerator import LissajousGenerator
from scanpointgenerator.plotgenerator import plot_generator
gen = LissajousGenerator(['x', 'y'], ["mm", "mm"], [0.0, 0.0], [1.0, 1.0],
lobes=3, size=50)
plot_generator(gen)
(Source code, png, hires.png, pdf)
The number of points has been lowered from the default to make the plot more visible. The following plot is for 10x11 lobes with the default number of points.
from scanpointgenerator import LissajousGenerator
from scanpointgenerator.plotgenerator import plot_generator
gen = LissajousGenerator(['x', 'y'], ["mm", "mm"], [0.0, 0.0], [1.0, 1.0],
lobes=20)
plot_generator(gen, show_indexes=False)
(Source code, png, hires.png, pdf)