Methods

The following methods return 1 on successful completion:

$s1->activate();
$s1->activate( clear => "1");
$s1->deactivate();
Activate/deactives a SCAN. Active SCANs are displayed

$s1->autoscale();
$s1->autoscale( x => "yes");
$s1->autoscale( y => "yes");
$s1->autoscale( max => 5);
$s1->autoscale(window => "yes");
Choose approriate axes.

$s1->calc( expr => "calc-expr");

 
my $temp = $s1->get( "name"); 
$s1->calc( expr => "$temp > 0”);

For explanations see 7.4.5.

$s1->cursor();
Invoke the cursor module.

$s1->exchange();
Exchange x and y.

$s1->derivative();
Replaces the SCAN by its derivative.

$s1->display();
Displays the SCAN.

$s1->display( update => "yes");
An implicit cls() is executed only, if the axes changed

$s1->get( "itemName");
Get an item value. See 7.4.3.

$s1->hide();
$s1->hide( clear => "1");
Sets/cleas the hidden bit.

$s1->linearRegression();
Replaces the SCAN by a line representing its linear regression. An example can be found in [*].

$s1->overlay();
Suppresses the drawing of the axis.

$s1->overlay( src => OtherName);
Suppresses the drawing of the axis and copies the window limits from OtherName.

$s1->postscript( file => "fname", # def.: laser.ps
print => 1, # default: 0
printer => "hasps1"); # default: see Spectra POST command
noconfirm => 1); # default: 0

$s1->preserve();
# sets the preserve bit $s1->preserve( clear => "1");
# clears the preserve bit

$s1->roi( min => $xmin, max => $xmax);
$s1->roi_net( min => $xmin, max => $xmax);
$s1->roi_bg( min => $xmin, max => $xmax);
Return ROI counts, netcounts or the background.

$s1->spacing( [dist]);
The x-values of the SCAN are equally spaced by dist (or 1), the y-values are interpolated.

$s1->set( itemName => "itemValue");
Set an item.

$s1->sort();

$s1->sum( min => $index1, max =>$index);
Min and max specify the range of the sum, min >= 0.

$s1->type();

$s1->write( format => "fio", # fio, asc, gqe, def.: fio
file_name => "...", # default: name
fio_comments => "yes",
fio_params => "p1 val1 p2 val2 ...",
hexapod => "yes", # default: "no"
mca => "yes", # default: "no"
motors => "yes", # include motor positions, default: "no"
ro => "yes", # default: "no", fio feature, ro == 444, read-only
scan => "yes", # default: "no"
ssa => "yes", # default: "no"
nolog => "yes", # default: "no"
noconfirm => "yes"); # default: "no"

my ($ssa_status, $cms, $midpoint, $int,
$bg_int, $fwhm, $peak_x, $peak_y, $bg_l, $bg_r) = $s1->ssa();

The contents of the symbols fio_comment_i (1=1, 10) are written to the .fio file, e.g.:

$Spectra::SYM{ fio_comment_1} = "some message";
$Spectra::SYM{ fio_comment_2} = "[text(\"mot3 = \"gmup( mot3))]";

fio_comment_2 is defined rather complicated. The reason is that it has to be evaluated at the time the file is created (gmup() translates to get-motor-unit-position).

If the flag fio_comments is supplied, the function Spectra::fio_comments() is called when the output file is created. The function returns a string which is written into the comment section of the file. The string may consist of several lines, e.g.:

#
# \online_dir\TkIrc.pl is a good place to define this function
#
sub Spectra::fio_comments
{
    my $string = "";
    $string .= "line 1\n";
    $string .= "line 2\n";
    $string .= "! line 3\n";
    $string .= "! line 4\n";
    return $string;
}

Lines that do not begin with an exclamation mark are considered as “official” Spectra comments. Mind that at most 10 of these can be stored (including the comments that are generated somewhere else). If a line begins with an exclamation mark “!”, it is written into the output file. But it is ignored by Spectra when the file is read. Still it is in the .fio file and it can be extracted by some script.

The symbol flag_additional_fio_comments can also be used to invoke the Spectra::fio_comments() feature.

The simple scan analysis (Ssa) can also be called as a function:

my ($ssa_status, $cms, $midpoint, $int, 
    $bg_int, $fwhm, $peak_x, $peak_y,
    $bg_l, $bg_r) = Ssa( "$name_scan");

There are 3 methods of passing data from Perl to Spectra, i.e. filling SCANs. These methods are demonstrated in the following exmple sections.