The following piece of code executes a scan with two motors following an arbitrary path, independent of each other. The virtual counters VC13 and VC14 are prepared to read the positions. This way the positions are stored the output file.
# # @pos_x and @pos_y are filled with some positions, e.g. a spiral # my @pos_x = (); my @pos_y = (); foreach my $x (0 ... 10) { @pos_x = (@pos_x, $x/10.); @pos_y = (@pos_y, $x/10. + 1); } Spectra::scan( device => "dummy", start => 0, stop => (scalar(@pos_y) - 1), # use the array length to calc. the stop value delta => 1, st => 0.1, title => "A Test Scan", profile => { timer => [ qw( exp_t01)], counter => [ qw( exp_c01 exp_c02 vc13 vc14)], # VC13 and VC14 read the positions of the motors exp_mca01 => { channels => 8192}, sca1 => { mca => "exp_mca01", min => 1000, max => 2000}, flags => [ qw( write_to_disk 1 display_deadtime 1 bell_on_scan_end 1)], before_during_function => sub { Spectra::move( exp_dmy01 => $pos_x[ $Spectra::SYM{ sindex} - 1], exp_dmy02 => $pos_y[ $Spectra::SYM{ sindex} - 1]); }});