Mutators¶
Mutators are used for post processing points after they have been generated and filtered by any regions of interest.
-
class
scanpointgenerator.
Mutator
[source]¶ Abstract class to apply a mutation to the points of an ND ScanPointGenerator
-
mutate
(iterator)[source]¶ Abstract method to take each point from the given iterator, apply a mutation and then yield the new point
Parameters: iterator (iter) – Iterator to mutate Yields: Point – Mutated points from generator
-
RandomOffsetMutator¶
This is used to apply a random offset to each point in an iterator. Here we apply it to a snake scan
from scanpointgenerator import LineGenerator, CompoundGenerator, plot_generator
xs = LineGenerator("x", "mm", 0.0, 0.5, 5, alternate_direction=True)
ys = LineGenerator("y", "mm", 0.0, 0.5, 4)
gen = CompoundGenerator([ys, xs], [], [])
plot_generator(gen)
And with the random offset
from scanpointgenerator import LineGenerator, CompoundGenerator, RandomOffsetMutator, plot_generator
xs = LineGenerator("x", "mm", 0.0, 0.5, 5, alternate_direction=True)
ys = LineGenerator("y", "mm", 0.0, 0.5, 4)
random_offset = RandomOffsetMutator(seed=1, axes = ["x", "y"], max_offset=dict(x=0.05, y=0.05))
gen = CompoundGenerator([ys, xs], [], [random_offset])
plot_generator(gen)