Skip to content

xraypy/larch_plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mauro’s Larch plugins

This repository contains additional plugins developed for Larch. A a brief description is given in the following, but the best is to read directly the __doc__ strings in the source code. The Python files have a test/example included in the __main__ block, while an additional Larch script, called pluginname_test.lar, does the same with the domain specific language (DSL).

To report bugs, enhancements or comments, please use the Issues.

Specfile

To read SPEC files from Certified Scientific Software (http://www.certif.com/)

Notes

Regarding the Python class to read SPEC files, I have evaluated:

  1. specfilewrapper from PyMca (rewritten in Python from the specfile C class developed at ESRF)
  2. pyspec (http://pythonhosted.org/pyspec/)
  3. specparser (https://github.com/tpikonen/specparser)
  4. specfile, the one included in TDL (https://github.com/xraypy/tdl)

To my opinion, (1) is the best choice for simplicity, versatility and maintenance. (2) is a nice project too but cannot handle motors names that include a dot, as e.g. ‘Mono.Energy’.

Pymca

To let Larch use PyMca as an external library and/or interact with it.

Notes (a.k.a PyMca’s HowTo)

Full PyMca layout from command line

from PyMca import PyMcaMain
w = PyMcaMain.PyMcaMain()

#to access the scan window
w.scanwindow.addCurve(...) #see below for more options

Plotting window object

from PyMca import ScanWindow()
w = ScanWindow.ScanWindow()
w.show()
w.addCurve(x, y, legend, info) # [x, y] is your data array
##The complete method signature is:
##addCurve(self, x, y, legend=None, info=None, replace=False, replot=True)
##info : dictionary with info on the curve

# To get back the data objects from the plot in order to perfom some analysis
w.getActiveCurve() #only the active curve
w.getAllCurves() #all plotted curves

Accessing data widget

from PyMca import QDataSource
from PyMca import QSpecfileWidget
w = QSpecfileWidget.QSpecFileWidget()
d = QDataSource.QDataSource(YOUR_FILE_NAME_STRING)
w.setData(d)
w.show()

Call a protected method

An example on how to call a protected method, that is, a method starting with double underscore __:

from PyMca import ScanWindow
w = ScanWindow.ScanWindow()
#...
w.__ScanWindow__SimpleOperation("save")
w.__ScanWindow__QSimpleOperation("save")

Future plugins

Here a list (without order) of future plugins that could help the daily work of x-ray spectroscopists (contributions are welcome!):

  • basic operations on XES (x-ray emission spectroscopy) and RIXS (resonant inelastic x-ray scattering) data files: normalization, merge, dichroism, convolution/deconvolution
  • implement IAD (integral of the absolute difference) data analysis for XES
  • interacting with theoretical softwares: FDMNES, FEFF, GPAW, ASE

Python projects for spectroscopists

I keep in the following a not exhaustive and not ordered list of nice Python-based projects useful for daily work and to get inspiration for future plugins:

  • Prestopronto : developed at ESRF-ID24/BM23; it uses the old Ifeffit Version 1 Python wrapper.
  • XrayLib : all the X-ray tables at your fingers!
  • Quantities : something like XrayLib… not tested yet.
  • Fityk : one of the best open source peak fitting software that has a Python wrapper that just rocks!
  • PPM : X-ray reflectivity by Alessandro Mirone (ESRF).
  • CARD : ReflEXAFS data analysis using PPM and Ifeffit1.
  • Shadow3 : it has a Python wrapper.
  • XRayTracer : powerful Python x-ray tracing engine by Konstantin Klementiev at ALBA.
  • GuiQWT : if you are not happy with PyMca!
  • ASE : atomistic calculations made easy.
  • GPAW : DFT in Python.
  • PyQuante : to understand Quantum Chemistry practical methods or solve single/two electrons integrals; unfortunately the project seems not developed anymore.
  • SAGE : only for mathematicians.
  • SymPy : symbolic mathematics for physicists.

About

Additional plugins for Larch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published