Pilatus100k, 300k, Tango

The following lines show how a Pilatus100k or Pilatus300k detector is introduced to Online, file name: /online_dir/online.xml

<?xml version="1.0"?>
<hw>
#
#
#
  <device>
    <name>pilatus</name> 
    <type>detector</type> 
    <module>pilatus100k</module>
    <device>bw4/pilatus/300k</device> 
    <control>tango</control> 
    <hostname>hasb1:10000</hostname>
  </device>
</hw>

The module name, pilatus100k, is the same for both device types.

The Tango server can be started only, if the camserver is running:

 
$ ssh -X det@SomePilatusPc
cd /home/det/p2_det
./runtvx
  camserver stays alive
  kill the client (the window that contains 'disconnect')

Notice that the state of the Tango server has to be sensed before a StartStandardAcq command is issued. Otherwise the camserver may enter a faulty state. In the case it is not possible to take sequences of frames.

The Perl-Spectra manual describes the Pilatus functions and gives an example of a virtual counter that uses these functions to operate the Pilatus.

Figure 43.1: Jive, Pilatus, Socket
Image JivePilatus300kSocket

Figure 43.2: Jive, Pilatus
Image JivePilatus300k

The Pilatus detector can be operated as a virtual counter:

 
   if( $method =~ /reset/i)
   {
     Util::log( "VC5: scan_name $Spectra::SYM{ scan_name}"); 
     Spectra::tng_attrLongWrt( "pilatus", "NbFrames", 1); 
     Spectra::pilatus_start( "pilatus", $Spectra::SYM{ scan_name},
                             $Spectra::SYM{ sample_time},  
                             $Spectra::SYM{ sindex},
                             ".tif");
    return 1;
   }
 
   if( $method =~ /read/i)
   {
     while( Spectra::tng_state( "pilatus")
     {
        Util::log( "waiting for Pilatus, state " . Spectra::tng_state( "pilatus"));
        Spectra::wait( 0.5); 
        if( $Spectra::SYM{ interrupt_scan})
        {
          Util::log( "wait-for-pilatus aborted");  
          last;
        }
     } 
     Util::log( "pilatus state " . Spectra::tng_state( "pilatus");
     return 1; 
   }

At haspp03nano the configuration of the Pilatus detector is done using a script:

#!/bin/env perl
#
# pilatus
#
use Spectra; 

my ( $keyword, $value) = @ARGV; 

if( !defined( $keyword) )
{
    print "\n\n Usage: \n";
    print "  picfg keyword [value] \n\n";
    print "   keywords: \n";
    print "     FileDir \n";
    print "     FilePrefix \n";
    print "     DelayTime \n";
    print "     ExposureTime \n";
    print "     FileStartNum \n";
    print "\n\n"; 
    goto finish;
}

#
# read the attributes
#
if( !defined( $value))
{
    if( $keyword =~ /FileDir/i)
    {
        $result = Spectra::tng_attrStringRd( "pilatus", $keyword); 
    }
    elsif( $keyword =~ /FilePrefix/i)
    {
        $result = Spectra::tng_attrStringRd( "pilatus", $keyword); 
    }
    elsif( $keyword =~ /FileStartNum/i)
    {
        $result = Spectra::tng_attrLongRd( "pilatus", $keyword); 
    }
    elsif( $keyword =~ /DelayTime/i)
    {
        $result = Spectra::tng_attrDoubleRd( "pilatus", $keyword); 
    }
    elsif( $keyword =~ /ExposureTime/i)
    {
        $result = Spectra::tng_attrDoubleRd( "pilatus", $keyword); 
    }
    print "\n $result \n\n"; 
}
#
# set the attributes
#
else
{
    if( $keyword =~ /FileDir/i)
    {
        Spectra::tng_attrStringWrt( "pilatus", $keyword, $value); 
    }
    elsif( $keyword =~ /FilePrefix/i)
    {
        Spectra::tng_attrStringWrt( "pilatus", $keyword, $value); 
    }
    elsif( $keyword =~ /FileStartNum/i)
    {
        Spectra::tng_attrLongWrt( "pilatus", $keyword, $value); 
    }
    elsif( $keyword =~ /DelayTime/i)
    {
        Spectra::tng_attrDoubleWrt( "pilatus", $keyword, $value); 
    }
    elsif( $keyword =~ /ExposureTime/i)
    {
        Spectra::tng_attrDoubleWrt( "pilatus", $keyword, $value); 
    }
}

finish:
    1;

There is another script for the acquisition:

#!/bin/env perl
#
# Pilatus -> VC2
#
use Spectra; 

my $status = 1;
my ( $sample_time, $np) = @ARGV; 

if( !defined( $sample_time) ||
    !defined( $np))
{
    print "\n\n Usage: \n\n";
    print "  piacq sampleTime Np \n";
    print "\n\n";
    goto finish;
    
}

if( !defined( $Spectra::SYM{ generic_scan_name}))
{
    $Spectra::SYM{ generic_scan_name} = "hasylab";
}

if( $np < 1)
{
    Spectra::error("piacq: np < 1");
    goto finish;
}

if( $np == 1)
{
    $status = Spectra::scan( device => "dummy", 
                             np => $np, 
                             st => $sample_time,
                             title => "A Pilatus Test Scan", 
                             profile => 
                             { timer => [ qw(t01)], 
                               counter => [ qw( p03nano_c01 vc2 ipetra)], 
                               flags => [ qw( write_to_disk 1
                                              display_deadtime 1
                                              bell_on_scan_end 1)], 
                                          });
}
else
{
    $status = Spectra::scan( device => "dummy", 
                             start => 0, 
                             stop => ($np - 1), 
                             delta => 1,
                             st => $sample_time,
                             title => "A Pilatus Test Scan", 
                             profile => 
                             { timer => [ qw(t01)], 
                               counter => [ qw( p03nano_c01 vc2 ipetra)], 
                               flags => [ qw( write_to_disk 1
                                              display_deadtime 1
                                              bell_on_scan_end 1)], 
                                          });
}

 finish:
    $status;

The file exp_ini.exp contains symbol assignments that allow the use to invoke the scripts from the command line:

!
! exp_ini.exp
!
piacq = "run [~.prog]piacq.pl"
picfg = "run [~.prog]picfg.pl"