You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 83 Next »


Above: A screenshot of realtime AMI plots generated in the TMO hutch during the LW08 experiment


NOTE: if you want to run ami on LCLS1 data, you can do it by generating an h5 file with the LCLS1 MPIDataSource.

To get the ami environment on the psana cluster:

ssh psana
source /cds/sw/ds/ana/conda2/manage/bin/psconda.sh

Run the appropriate command from the "examples" sections below and do (for example) the following:

  • click on "apply" (menu item near the top left) to activate the analysis "graph"
  • click on one of the green boxes to open a plot

For examples that load a predefined graph (.fc file, for "flow chart") you should see a window like this, while examples with no .fc file will have an empty area in the upper right:

Loading Data in AMI

There are three different ways to load data in AMI, either through using the gui, providing a json file, or by passing command line arguments. The different methods are described below.

Command Line Configuration

Given a psana experiment and run number the xtc2 files can be loaded using the following syntax:

ami-local psana://exp=tstx00417,run=82

A more complex example that loads a saved flowchart, sets the "heartbeat" interval (-b) to 1 (defaults to 10) and fetches events from disk at 1Hz ("-f interval", defaults to as fast as possible) is:

ami-local -l spike.fc -b 1 -f interval=1 psana://exp=rixdaq18,run=18

The "-f init_time=NN" (where "NN" is a number of seconds) can also be important.  It tells the data reading to wait and give the analysis side of ami a chance to startup.  This is necessary because the data reading portion starts immediately and can drop events, which is what ami needs to do when running in realtime (to ensure that it is only looking at recent data).

Loading Data through the GUI


The first option is to run ami-local without any flags. Once the main window appears, click the Configure button and the window in the image above will appear. From there hdf5 files or xtc2 files can be loaded by clicking on Add. Only one type of file may be loaded at a time, either hdf5 or xtc2, but multiple files can be loaded. AMI will loop through all the events in each file in the order they are loaded. The different options are explained below.

Note: If a source is configured through the gui configuration window, the source configuration will be saved with the graph and can be automatically reloaded by running ami-local -l <graph.fc>

JSON Configuration File


 {
    "interval": 0.01,
    "init_time": 0.5,
    "repeat": true,
	"files": ["run22.h5"]
}


Additionally a JSON file containing a source configuration may be provided. A URI to the file where the prefix contains the source type must be passed to AMI. For example to load the above file run ami-local hdf5:///worker.json to use the psana source run ami-local psana:///worker.json. 

Configuration Flags

FlagDescription
intervalTime in seconds to sleep between events
init_timeTime in seconds to sleep before emitting the first event
repeatLoop over files/events after reaching end
filesComma separated list of files to load (either xtc2 or hdf5)

These flags can be passed to the source using any of the three methods above, the gui configuration window, a json file, or using the -f command line flag. To specify multiple flags using the command line pass -f multiple times.  For example:

ami-local -f interval=1 psana://exp=tmoc00118,run=4,dir=/ffb01/data/tmo/tmoc00118/xtc/


TMO Examples

Example includes:

  • waveform viewing, ROI, integration and normalization of peak area
  • waveform peak finding, histogramming, and scaling of axes using a polynomial "calibration"

ami-local -l /reg/g/psdm/tutorials/ami2/tmo/run43.fc hdf5:///reg/g/psdm/tutorials/ami2/tmo/run43.json

Cookiebox example

ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amoi0314_run167.json
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amoi0314_run171.json
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amoi0314_run172.json
 
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amo86815_run37.json
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amo86815_run70.json
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amo86815_run71.json
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amo86815_run72.json 

Quadanode example

ami-local -l /reg/g/psdm/tutorials/ami2/tmo/amox27716-r0100.fc
 
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amox27716_run78.json
ami-local hdf5:///reg/g/psdm/tutorials/ami2/tmo/amox27716_run100.json

POP example

 ami-local -l /reg/g/psdm/tutorials/ami2/tmo/pop.fc

Peakfinder example

ami-local -l /reg/g/psdm/tutorials/ami2/tmo/amox27716_run100.fc

XTCAV example

ami-local -l /reg/g/psdm/tutorials/ami2/tmo/amox23616_run137.fc

Timetool example

ami-local -l /reg/g/psdm/tutorials/ami2/tmo/amo64913_run185.fc

HSD example

ami-local -l /reg/g/psdm/tutorials/ami2/tmo/hsd.fc -f repeat=true psana://exp=tstx00417,run=82

Blobfinder example

ami-local -f repeat=true -f interval=0.1 -f init=1 -l /reg/g/psdm/tutorials/ami2/tmo/blobfinder.fc psana://exp=tmoc00518,run=1

HitFinder example

ami-local -l /reg/g/psdm/tutorials/ami2/tmo/hitfinder.fc

RIX Examples

FlyScan: Mean Vs. Scan Value

An example of using the MeanVsScan Box to plot an average parameter (in this case the width of a distribution) vs. the fly-scanned PV.  "fly-scan" means the scan value is changed independently while the DAQ free-runs.

ami-local -l /reg/g/psdm/tutorials/ami2/neh2.2/rix_flyscan.fc psana://exp=rixx43518,run=34,dir=/cds/data/psdm/prj/public01/xtc

Waveform Sideband Subtraction

Demonstrates a 2D ROI, projection, and subtraction of average of 1D ROI of the projection.

ami-local -b 1 -f interval=1 -l /reg/g/psdm/tutorials/ami2/neh2.2/rix_bkgdsub.fc psana://exp=rixx43518,run=34,dir=/cds/data/psdm/prj/public01/xtc

Step-Scan With Gaussian Fit

Imperfections that need to be addressed:  the method of detecting that a step has finished (triggering the fit) is kludgy, so the last step is currently ignored.  Pedestal subtraction helps the fit significantly and is done in a kludgy way with using /reg/g/psdm/tutorials/ami2/neh2.2/manta_ped.py which generates a numpy pedestal file /reg/g/psdm/tutorials/ami2/neh2.2/manta_ped.npy.  Subtraction is done with a PythonEditor box.

ami-local --ipc -f interval=0.1 -l /reg/g/psdm/tutorials/ami2/neh2.2/rix_width_scan.fc psana://exp=rixx43518,run=45,dir=/cds/data/psdm/prj/public01/xtc

Photon Finding and Check of Linearity

Example includes:

  • photon centroid finding on vertically binned Andor camera
  • linearity check of normalization (andor camera intensity vs. acqiris waveform intensity) with pearson-R calculation as a function of time
ami-local -l /reg/g/psdm/tutorials/ami2/neh2.2/run22.fc hdf5:///reg/g/psdm/tutorials/ami2/neh2.2/worker.json

Waveform Integration vs. Delay Stage

Example includes:

  • Plot of integration of acqiris vs delay stage

ami-local -l /reg/g/psdm/tutorials/ami2/neh2.2/sxrlr2916_run37.fc

Normalization of Andor

Example includes:

  • 1d ROI of Andor
  • Normalization of ROI by integration of acqiris

ami-local -l /reg/g/psdm/tutorials/ami2/neh2.2/sxrlr2916_run23.fc

Ratio of Peak Areas and EPICS Export of Result

Example includes:

  • Ratio of peak area and export over EPICS

ami-local -e ami -l /reg/g/psdm/tutorials/ami2/neh2.2/sxrlq7615_run176.fc
pvlist localhost:5075
pvget ami:ana:graph:data:peak_area

XPP Example


 ami-local hdf5:///reg/g/psdm/tutorials/ami2/xpp/xpp.json

Random Data Examples

Calculator example

Example includes:

  • calculator executing based on conditional logic

 ami-local -l /reg/g/psdm/tutorials/ami2/random/calculator.fc random:///reg/g/psdm/tutorials/ami2/random/worker.json

Complex example


 Example includes:

  • binning based on conditional logic
ami-local -l /reg/g/psdm/tutorials/ami2/random/complex_example.fc random:///reg/g/psdm/tutorials/ami2/random/worker.json

Reporting AMI Issues:

Users are encouraged to submit AMI bug reports, feature requests, and questions through github issues: https://github.com/slac-lcls/ami/issues

If appropriate, please include an experiment, run number, and example graph so AMI can be run in off-line mode to reproduce issues. 


  • No labels