The command line interface (shell)

The script TngEigerCli.py is a very simple interface to operate the Eiger2 detector.

 
p07user@haspp07eh2:~$ TngEigerCLI.py 
usage: TngEigerCLI.py [-h] [--pe PHOTONENERGY] [--et ENERGYTHRESHOLD]
                      [--ct COUNTTIME] [--pf PREFIX] [--tm] [--nbt NBTRIGGERS]
                      [--nbi NBIMAGES] [--ipf IMAGESPERFILE] [--ints] [--exts]
                      [--extssim] [--fh] [--default] [--list] [--init]
                      [--delete] [--download] [--write] [--read] [--display]
                      [namePattern [namePattern ...]]

Command line interface to the Eiger detectors 

positional arguments:
  namePattern           ['p07e2x4m', 'p08e1m', 'p08e2x1m', 'p10e4m',
                        'p62e2x4m', 'p62e2x9m']

optional arguments:
  -h, --help            show this help message and exit
  --pe PHOTONENERGY     the x-ray energy of the experiment [eV], e.g.: 8980 eV
  --et ENERGYTHRESHOLD  energy threshold [eV], e.g.: 4020 eV
  --ct COUNTTIME        the time the detector counts photons
  --pf PREFIX           prefix used in
                        current/raw/SingleShots/<devName>/<prefix>_$id
  --tm                  "ints" or "exts"
  --nbt NBTRIGGERS      set NbTriggers attribute, e.g.: 1
  --nbi NBIMAGES        the number of images in a series of images after a
                        trigger
  --ipf IMAGESPERFILE   images per file
  --ints                execute a run with using internal triggers
  --exts                execute a run with using external triggers
  --extssim             execute a run with using external triggers, simulate
                        with oreg
  --fh                  Displays some lines from the Dectris docu
  --default             set EigerPars with default attributes, no I/O
  --list                list the files on the DCU
  --init                sets the Eiger attributes to some defaults
  --delete              delete the files on the DCU
  --download            download files to ScanDir
  --download_scandir    download files to ScanDir
  --download_dldir      download files to DownloadDirectory (Tango server attribute)
  --write               write EigerPars_<name> dict to servers
  --read                read selected attributes from servers
  --display             display the MS env. dictionary EigerPars_<name>

  TngEigerCLI.py p62e2x4m 
        list selected attributes from EigerPars_<name> 
  TngEigerCLI.py p62e2x4m --ct 1.5
        set the count time to 1.5 s in EigerPars_<name> and in the device

  TngEigerCLI.py p62e2x4m --list             list the DCU files
  TngEigerCLI.py p62e2x4m --download         download the DCU files to ScanDir
  TngEigerCLI.py p62e2x4m --download_scandir download the DCU files to ScanDir
  TngEigerCLI.py p62e2x4m --download_dldir   download the DCU files to DownloadDirectory (TS attribute) 
  TngEigerCLI.py p62e2x4m --delete           delete the DCU files and directories

  TngEigerCLI.py p62e2x4m --nbt 10 --ct 0.01 --ipf 10 --nbi 10
    10 software trigger, countTime 0.01, frameTime = ct + frameTimeMin
    images per file 10, number of images 10
    Update EigerPars_<name> and the device

  TngEigerCLI.py p62e2x4m --ints     write EigerPars_<name> then execute internal trigger run 
  TngEigerCLI.py p62e2x4m --exts     write EigerPars_<name> then execute external trigger run 
  TngEigerCLI.py p62e2x4m --extssim  write EigerPars_<name> then execute a sim. external trigger run 

   ['p08e2x1m', 'p10e4m', 'p11e2x16m', 'p62e2x4m', 'p02e2x4m', 'p62e2x9m', 'p07e2x4m']

EigerCli.py stores attribute values in a dictionary, a Macroserver environment variable called EigerPars_<name>. This way, the user selections are made persistent. Before a run is launched these parameters are written to the detector and the filewriter. The contents of EigerPars_<name> can be inspected by:

 
p99user@hasnp99eh:~/temp$ TngEigerCLI3.py p99e2x4m --display

The contents of EigerPars_p99e2x4m
(MacroServer environment variable)
  Name                : p99e2x4m
  APIVersion          : ['1.8.0']
  DeviceName          : haspp99eh2:10000/p99/eiger/e4m
  FilewriterName      : haspp99eh2:10000/p99/eiger_filewriter/e4m
  FilewriterMode      : enabled

  CountTime           : 0.42
  EnergyThreshold     : 4020.0
  ImagesPerFile       : 10
  NbImages            : 10.0
  NbTriggers          : 1
  PhotonEnergy        : 8980.0
  Prefix              : tst
  TriggerMode         : ints

To change the CountTime attribute:

 
p99user@haspp99eh2:~$ TngEigerCLI.py p99e2x4m --ct 0.1
Eiger.writeAttrs: CountTime to 0.1
Eiger.writeAttrs: TriggerMode to ints
Eiger.writeAttrs: NbTriggers to 1
Eiger.writeAttrs: NbImages to 10
Eiger.writeAttrs: ImagesPerFile to 10
Eiger.writeAttrs: FilenamePattern to current/raw/SingleShots/p99e2x4m/tst_$id

Read selected attributed from p99e2x4m 
  Device              haspp99eh2:10000/p99/eiger/e4m 
  Filewriter          haspp99eh2:10000/p99/eiger_filewriter/e4m 
 
  CountTime           0.1
  NbImages            10
  NbTriggers          1
  TriggerMode         ints
  State               tango._tango.DevState.ON

  FW FilenamePattern  current/raw/SingleShots/p99e2x4m/tst_$id
  FW mode             enabled
  FW ImagesPerFile    10
  FW State            tango._tango.DevState.ON

Next we start a run using the internal trigger mode:

 
p10user@haspp10lab:~/temp$ TngEigerCLI.py p10e4m --ints

runInts: FilenamePattern current/raw/SingleShots/p10e4m/tst_$id
runInts: CountTime 0.01
runInts: FrameTime 0.0113323
runInts: NbImages 10
runInts: NbTriggers 5
runInts: ImagesPerFile 10
runInts: arm()
......

trigger 0
 0.120812/0.113323   
trigger 1
 0.123407/0.113323   
trigger 2
 0.123452/0.113323    
trigger 3
 0.12443/0.113323    
trigger 4
 0.122332/0.113323    
..
FW state() ON after 0.211571 s

runInts: disarm()
runInts: NbImages 1
runInts: NbTriggers 1

To inspect the files on the DCU (this makes sense only if HiDRA is not in operation):

 
p99user@haspp99lab:~/temp$ TngEigerCLI.py p99e4m --list
crawler: url http://haspp99e4m.desy.de/data 
crawler: url http://haspp99e4m.desy.de/data/current/ 
crawler: url http://haspp99e4m.desy.de/data/current/raw/ 
crawler: url http://haspp99e4m.desy.de/data/current/raw/SingleShots/ 
crawler: url http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/ 
  listFunc: http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000001.h5
  listFunc: http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000002.h5
  listFunc: http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000003.h5
  listFunc: http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000004.h5
  listFunc: http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000005.h5
  listFunc: http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_master.h5

These files can be downloaded to ScanDir:

 
p99user@haspp99lab:~/temp$ TngEigerCLI.py p99e4m --download
crawler: url http://haspp99e4m.desy.de/data 
crawler: url http://haspp99e4m.desy.de/data/current/ 
crawler: url http://haspp99e4m.desy.de/data/current/raw/ 
crawler: url http://haspp99e4m.desy.de/data/current/raw/SingleShots/ 
crawler: url http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/ 
downLoad http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000001.h5s -> 
    /gpfs/commissioning/raw/svk_zipgrp_00010//tst_74_data_000001.h5
 100%downLoad http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000002.h5s -> 
    /gpfs/commissioning/raw/svk_zipgrp_00010//tst_74_data_000002.h5
 100%downLoad http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000003.h5s -> 
     /gpfs/commissioning/raw/svk_zipgrp_00010//tst_74_data_000003.h5
 100%downLoad http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000004.h5s -> 
    /gpfs/commissioning/raw/svk_zipgrp_00010//tst_74_data_000004.h5
 100%downLoad http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_data_000005.h5s -> 
    /gpfs/commissioning/raw/svk_zipgrp_00010//tst_74_data_000005.h5
 100%downLoad http://haspp99e4m.desy.de/data/current/raw/SingleShots/p99e4m/tst_74_master.h5s -> 
    /gpfs/commissioning/raw/svk_zipgrp_00010//tst_74_master.h5