Alignment of 8 Motors, SLAC

The following script uses SSA to align 8 motors.

 
#!/usr/bin/env perl
use strict; 
my $status = 1; 
#
# 8 motors are aligned, one after the other, 
# the @motors array defines the sequence
#
my @motors = qw( exp_mot01 exp_mot02 exp_mot03 exp_mot04 
                 exp_mot05 exp_mot06 exp_mot07 exp_mot08); 

my %ranges = ( exp_mot01 => 1.1,
               exp_mot02 => 1.2,
               exp_mot03 => 1.3,
               exp_mot04 => 1.4,
               exp_mot05 => 1.5,
               exp_mot06 => 1.6,
               exp_mot07 => 1.7,
               exp_mot08 => 1.8,
               ); 
my $np = 51; 
my $st =  0.1;  # sample time

foreach my $mot ( @motors)
{
    my $pos = Spectra::gmup( $mot); 
    Util::log( "aligning $mot, range $ranges{$mot}, now at $pos "); 
    if( !Spectra::scan( type => "motor", 
                        device => $mot, 
                        range => $ranges{$mot},
                        np => $np,
                        st => $st,    
                        comment => "Aligning $mot, range $ranges{$mot}",
                        ssa => 1, 
                        #
                        # auto_return: 2 - midpoint, 3 - cms, 4 - peak
                        #
                        auto_return => 2,  
                        #
                        # the device selection by 'profile' is valid only 
                        # this scan function
                        #
                        profile => 
                        {
                            timer => [ qw( exp_t01)],
                            counter => [ qw( vc17)] 
                        }))
    {
        $status = Spectra::error( " Failed to align $mot");
        goto finish;
    }
    my $pos = Spectra::gmup( $mot); 
    Util::log( "aligning $mot, DONE, now at $pos "); 
}
finish:
$status;