Python Scripted Calibration
===========================

First: do not run this on the Maxell gateway. Rather, `salloc`
a node for yourself first::

   salloc -p exfel/upex -t 01:00:00

where `-p` gives the partition to use: exfel or upex and `-t`
the duration the node should be allocated. Then `ssh` onto 
that node.

(optionally) Set up the environment::

   source setup_env.sh

On Maxwell execution rights might be stripped. If you get
an error for the above command, first run::

   chmod +x setup_env.sh

If running headless, be sure to set `MPLBACKEND=Agg`, via::

   export MPLBACKEND=Agg

This is automatically done if you source the environment script.


Run the script::

    python calibrate.py --input /gpfs/exfel/exp/SPB/201701/p002012/raw/r0100 \
       --output ../../test_out --mem-cells 30 --detector AGIPD --sequences 0,1   

Here `--input` should point to a directory of `RAW` files for the detector you
are calibrating. They will be output into the folder specified by `--output`, 
which will have the run number or the last folder in the hiearchy of the input
appended. Additionally, you need to specify the number of `--mem-cells` used
for the run, as well as the `--detector`. Finally, you can optionally 
specify to only process certain `--sequences` of files, matching the sequence
numbers of the `RAW` input. These should be given as a comma-separated list.

You'll get a series of plots in the output directory as well.