Summary

Source: https://github.com/vasole/pymca

License:  https://github.com/vasole/pymca/blob/master/LICENSE

Path:  see below

Documentation: https://www.silx.org/doc/PyMca/latest/index.html

Citation: V.A. Sole, E. Papillon, M. Cotte, Ph. Walter, J. Susini, A multiplatform code for the analysis of energy-dispersive X-ray fluorescence spectra, Spectrochim. Acta Part B 62 (2007) 63-68.

X-Ray Fluorescence Analysis Toolkit and Application. Stand-alone application and Python tools for interactive and/or batch processing analysis of X-Ray Fluorescence Spectra. Graphical user interface (GUI) and batch processing capabilities provided.The associated ROI Imaging Tool extends analysis capabilities to other techniques in which data can be represented by a three-dimensional array like in sample scanning experiments in which a spectrum is collected at different sample points (Raman, FT-IR, XAS, XRF, …).

Using pymca

pymca5 is available on Maxwell in two variants.

System installaion

which pymca
   /usr/bin/pymca

python3 -c 'import PyMca5; print(PyMca5.__version__)'
   5.5.3


conda/mamba based installation

We recommend using the conda/mamba based installation, much more up-to-date (bzt the python version is still 3.6.x).

module load maxwell 
module avail pymca
   pymca/5.5.3 pymca/5.8.1
 
module load pymca
python3 -c 'import PyMca5; print(PyMca5.__version__)'
   5.8.1

# package information
xwhich pymca 
 Local path for pymca:
    /usr/bin/pymca 

 Provided by module(s)
  ... module load maxwell pymca/5.5.3                          which pymca: /software/anaconda3/5.2/bin/pymca 
  ... module load maxwell pymca/5.8.1                          which pymca: /software/jupyter/.conda/envs/pymca-5.8.1/bin/pymca 
  ... module load maxwell pyFAI/0.20.0                         which pymca: /software/anaconda3/5.2/bin/pymca 
  ... module load maxwell anaconda3/5.2                        which pymca: /software/anaconda3/5.2/bin/pymca 
  ... module load anaconda3/5.2                                which pymca: /software/anaconda3/5.2/bin/pymca 
  ... module load anaconda/3                                   which pymca: /software/anaconda3/5.2/bin/pymca 

 Documentation: https://confluence.desy.de/display/MXW/pymca
 URL:           https://pypi.python.org/pypi/PyMca
 Manual:        http://pymca.sourceforge.net/documentation.html
 License:       GPL

   

 

Running pymca in batch

Some pymca-jobs require a X11-terminal, which is not an option in slurm batch jobs. To get around that, you could use XVFB (virtual frame buffer):

Sample batch script
#!/bin/bash
#SBATCH --partition=maxcpu
#SBATCH --time=0-00:20:00
unset LD_PRELOAD

# virtual display
export DISPLAY=:99.0
export SCREEN_WIDTH=1200
export SCREEN_HEIGHT=960
export SCREEN_DEPTH=24
export GEOMETRY="${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH}"

# pymca setup, will of course differ for your configuration
export configfile=pymca.cfg
export outputdir=pymca_out
export input=pymca.in

# run pymcabatch on virtual display
xvfb-run --server-args="$DISPLAY -screen 0 $GEOMETRY -ac +extension RANDR" \
pymcabatch --selection=1 --filestep=1 --cfg=$configfile --h5=1 --exitonend=1 --table=2 \
           --edf=1 --overwrite=1 --html=0 --tif=1 --csv=1 --mcastep=1 --htmlindex=index.html \
           --concentrations=0 --showresult=0 --fitfiles=1 --outdir=$outputdir --dat=0 --roifit=0 \
           --multipage=0 --listfile=$input --diagnostics=0 --debug=0 --nproc=0