The following script demonstrates how an omega-2theta scan is executed at different positions of an outer loop motor. It also demonstrates how a scan parameter, the sample time, is specified for each position of the outer loop motor. It invoked from the command line of the Online widget. If the Scan widget is open, it will be updated. The script can be interrupted by pressing any Stop button.
#!/usr/bin/perl -w use strict; my $status = 1; # # the outer loop motor and its positions # my $mot = "mot2"; my @pos = qw( 7 7.5 8); # # different sample times for different positions # of the outer loop motor # my @st = qw( 0.1 0.2 0.3); foreach my $i ( 0 .. (scalar( @pos) - 1)) { if( !Spectra::move( $mot => $pos[$i])) { $status = Spectra::error( "failed to move $mot"); goto finish; } # # inner loop: omega-2theta scan # Util::log( "execute a om_tt scan"); if( !Spectra::scan( type => "om_tt", start => 3, stop => 4, delta => 0.5, st => $st[$i], # sample time comment => "$mot at $pos[$i]")) { $status = Spectra::error( " Failed to scan om_tt"); goto finish; } } finish: $status;