from math import degrees, radians, sin, cos
from vortex import Range
from vortex.scan import RasterScan
from vortex_tools.scan import plot_annotated_waveforms_space

scan = RasterScan()
cfg = scan.config
cfg.volume_extent = Range.symmetric(2)
cfg.angle = radians(30)
cfg.samples_per_segment = 100
cfg.loop = True
scan.initialize(cfg)

_, ax = plot_annotated_waveforms_space(scan.scan_buffer(), scan.scan_markers(), inactive_marker=None, scan_line='w-')
ax.plot([-sin(cfg.angle), 0, cos(cfg.angle)], [cos(cfg.angle), 0, sin(cfg.angle)], 'ro-', zorder=20)
ax.set_title(f'Raster with {degrees(cfg.angle):.1f} Rotation')