Spiral Generator

class scanpointgenerator.SpiralGenerator(axes, units, centre, radius, scale=1.0, alternate=False)[source]

Generate the points of an Archimedean spiral

Parameters:
  • axes (list(str)) – The scannable axes e.g. [“x”, “y”]
  • units (list(str)) – The scannable units e.g. [“mm”, “mm”]
  • centre (list) – List of two coordinates of centre point of spiral
  • radius (float) – Maximum radius of spiral
  • scale (float) – Gap between spiral arcs; higher scale gives fewer points for same radius
  • alternate (bool) – Specifier to reverse direction if generator is nested
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]

Convert object attributes into a dictionary

classmethod from_dict(d)[source]

Create a SpiralGenerator instance from a serialised dictionary

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

Examples

This example defines motors “x” and “y” with engineering units “mm” which will be scanned in a spiral filling a circle of radius 5mm.

from scanpointgenerator import SpiralGenerator
from scanpointgenerator.plotgenerator import plot_generator

gen = SpiralGenerator(["x", "y"], "mm", [0.0, 0.0], 5.0)
plot_generator(gen)

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

_images/spiralgenerator-1.png

In this example the spiral is scaled to be more sparse.

from scanpointgenerator import SpiralGenerator
from scanpointgenerator.plotgenerator import plot_generator

gen = SpiralGenerator(["x", "y"], "mm", [0.0, 0.0], 5.0, scale=2.0)
plot_generator(gen)

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

_images/spiralgenerator-2.png