-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplot_check.py
125 lines (77 loc) · 3.2 KB
/
plot_check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
from scanpointgenerator import LineGenerator, CompoundGenerator
from scanpointgenerator import RectangularROI
from scanpointgenerator import CircularROI
from scanpointgenerator import SpiralGenerator
from scanpointgenerator import LissajousGenerator
from scanpointgenerator import RandomOffsetMutator
from scanpointgenerator import ROIExcluder
from scanpointgenerator.plotgenerator import plot_generator
from pkg_resources import require
require('matplotlib')
require('numpy')
require('scipy')
def grid_check():
x = LineGenerator("x", "mm", 0.0, 4.0, 5, alternate=True)
y = LineGenerator("y", "mm", 0.0, 3.0, 4)
gen = CompoundGenerator([y, x], [], [])
plot_generator(gen)
def grid_circle_check():
x = LineGenerator("x", "mm", 0.0, 4.0, 5, alternate=True)
y = LineGenerator("y", "mm", 0.0, 3.0, 4)
circle = ROIExcluder([CircularROI([2.0, 1.0], 2.0)], ['x', 'y'])
gen = CompoundGenerator([y, x], [circle], [])
plot_generator(gen, circle)
def spiral_check():
spiral = SpiralGenerator(['x', 'y'], ["mm", "mm"], [0.0, 0.0], 10.0)
gen = CompoundGenerator([spiral], [], [])
plot_generator(gen)
def spiral_rectangle_check():
spiral = SpiralGenerator(['x', 'y'], ["mm", "mm"], [0.0, 0.0], 10.0)
rectangle = ROIExcluder([RectangularROI([0.0, 0.0], 10.0, 10.0)], ['x', 'y'])
gen = CompoundGenerator([spiral], [rectangle], [])
plot_generator(gen, rectangle)
def lissajous_check():
bounding_box = dict(centre=[0.0, 0.0],span=[1.0,1.0], lobes=2)
lissajous = LissajousGenerator(['x', 'y'], ["mm", "mm"], **bounding_box)
gen = CompoundGenerator([lissajous], [], [])
plot_generator(gen)
def lissajous_rectangle_check():
bounding_box = dict(centre=[0.0, 0.0],span=[1.0,1.0], lobes=2)
lissajous = LissajousGenerator(['x', 'y'], ["mm", "mm"], **bounding_box)
rectangle = ROIExcluder([RectangularROI([0.0, 0.0], 0.8, 0.8)], ['x', 'y'])
gen = CompoundGenerator([lissajous], [rectangle], [])
plot_generator(gen, rectangle)
def line_2d_check():
line = LineGenerator(["x", "y"], ["mm", "mm"], [1.0, 2.0], [5.0, 10.0], 5)
gen = CompoundGenerator([line], [], [])
plot_generator(gen)
def random_offset_check():
x = LineGenerator("x", "mm", 0.0, 4.0, 5, alternate=True)
y = LineGenerator("y", "mm", 0.0, 3.0, 4)
mutator = RandomOffsetMutator(2,['x','y'], dict(x=0.25, y=0.25))
gen = CompoundGenerator([y, x], [], [mutator])
plot_generator(gen)
gen = CompoundGenerator([y, x], [], [mutator, mutator])
plot_generator(gen)
gen = CompoundGenerator([y, x], [], [mutator, mutator, mutator])
plot_generator(gen)
gen = CompoundGenerator([y, x], [], [mutator, mutator, mutator, mutator, mutator])
plot_generator(gen)
def serialise_grid_check():
x = LineGenerator("x", "mm", 0.0, 4.0, 5, alternate=True)
y = LineGenerator("y", "mm", 0.0, 3.0, 4)
gen = CompoundGenerator([y, x], [], [])
plot_generator(gen)
gen = gen.to_dict()
print(gen)
gen = CompoundGenerator.from_dict(gen)
plot_generator(gen)
grid_check()
grid_circle_check()
spiral_check()
spiral_rectangle_check()
lissajous_check()
lissajous_rectangle_check()
line_2d_check()
random_offset_check()
serialise_grid_check()