2D Scan, Single Motor Scan with Outer Loop

The following script shows how mot11 is scanned at different positions of mot12. These positions are -80, -79 and -78. Motor mot11 is scanned from 100 to 101 with a stepwidth of 0.1. The sample time is 0.1s.

#!/usr/bin/perl -w

use strict; 
my $status = 1; 
#
# the outer loop motor and its positions
#
my $mot = "mot12"; 
my @pos = qw( -80 -79 -78); 
my $st =  0.1;  # sample time

foreach my $pos ( @pos)
{
    if( !Spectra::move( $mot => $pos))
    {
	$status = Spectra::error( "failed to move $mot");
	goto finish;
    }
    #
    # inner loop: mot11
    #
    Util::log( "execute a mot11 scan "); 
    if( !Spectra::scan( type => "motor", 
			device => "mot11", 
			start => 135, 
			stop => 136,
			delta => 0.1, 
			st => $st,                  # sample time
			comment => "$mot at $pos"))
    {
	$status = Spectra::error( " Failed to scan ");
	goto finish;
    }
}
finish:
$status;