-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscan_explorer.py
More file actions
90 lines (68 loc) · 2.36 KB
/
Copy pathscan_explorer.py
File metadata and controls
90 lines (68 loc) · 2.36 KB
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
import numpy
import matplotlib
matplotlib.use('Qt5Agg')
from matplotlib import pyplot
from vortex import Range
from vortex.marker import Flags
from vortex.scan import RasterScan, RepeatedRasterScan, RadialScan, RepeatedRadialScan, FreeformScan, SequentialPattern, RasterScanConfig, RadialScanConfig
from vortex_tools.scan import plot_annotated_waveforms_time, plot_annotated_waveforms_space
def freeform():
t = numpy.linspace(0, 1, 500)
t2 = numpy.linspace(0, 5, 2500)
waypoints = [
numpy.column_stack((t+0.5, 0.3*t**2 + 0.5)),
numpy.column_stack((0.01*numpy.cos(50*t), t/2)),
numpy.column_stack((t/3+0.2, -t/2)),
numpy.column_stack((0.1*numpy.sin(2*t2 + 0.2) - 0.5, 0.2*numpy.cos(3*t2) - 0.5))
]
pattern = SequentialPattern().to_pattern(waypoints)
scan = FreeformScan()
cfg = scan.config
cfg.pattern = pattern
cfg.loop = True
scan.initialize(cfg)
show(scan, 'Freeform')
def standard(scan, name=None):
name = name or type(scan)
cfg = scan.config
cfg.loop = True
scan.initialize(cfg)
show(scan, name)
def radial_nonnegative():
scan = RadialScan()
cfg = scan.config
cfg.bscan_extent = Range(2, 5)
cfg.volume_extent = Range(1, 2)
cfg.loop = True
scan.initialize(cfg)
show(scan, 'Radial - Non-negative')
def raster_aim(name=None):
raster = RasterScanConfig()
raster.flags = Flags(0x1) # optional
aiming = RadialScanConfig()
aiming.set_aiming()
aiming.offset = (5, 0)
aiming.flags = Flags(0x2) # optional
n = raster.segments_per_volume
pattern = raster.to_segments()[:n//2] + aiming.to_segments() + raster.to_segments()[n//2:]
scan = FreeformScan()
cfg = scan.config
cfg.pattern = pattern
cfg.loop = True
scan.initialize(cfg)
show(scan, 'Raster + Aim')
def show(scan, name):
cfg = scan.config
fig, _ = plot_annotated_waveforms_time(cfg.sampling_interval, scan.scan_buffer(), scan.scan_markers())
fig.suptitle(name)
fig, _ = plot_annotated_waveforms_space(scan.scan_buffer(), scan.scan_markers())
fig.suptitle(name)
if __name__ == '__main__':
standard(RasterScan(), 'Raster')
standard(RepeatedRasterScan(), 'Repeated Raster')
standard(RadialScan(), 'Radial')
standard(RepeatedRadialScan(), 'Repeated Radial')
freeform()
radial_nonnegative()
raster_aim()
pyplot.show()