[Ifeffit] Problems importing larch plugins to python

Bruce Ravel bravel at bnl.gov
Fri Oct 2 08:09:33 CDT 2015

On 10/02/2015 06:27 AM, Johan Nilsson wrote:
> Thank you for providing the examples. I tried to to write my own script
> based on your examples and things appear to be working fine until I get
> to the point where I want to run feffit, then I get the traceback I've
> pasted here below. I've attached an archive with the script and the
> data, do you have any idea what the problem is here?


This reminds me a lot of one of the things I really struggled with
when I started working with Larch.  It turns out that, when you use
larch as a puthon script (as opposed to running it through larch
itself), every damn thing needs the '_larch=mylarch' argument.

I am guessing (although I have not tried running your script) that
your problem is that the calls defining "pars" and "path1" need a
_larch=mylarch argument.

Although it seems pretty clear that you basically get how to use larch
for fitting exafs data, you may find some examples helpful.  Here is
one such: 

Each of the materials at https://github.com/bruceravel/SCFtests/ has a
similar script in it.  In each case, the fit is wrapped inside of
function.  This is because that project is an automated testing
framework and, in each case, the fit is called by some other script.
But the structure of the fit is the same as what you are trying to
do.  Every call to a larch-y function needs a "_larch=mylarch".

Good luck,

  Bruce Ravel  ------------------------------------ bravel at bnl.gov

  National Institute of Standards and Technology
  Synchrotron Science Group at NSLS-II
  Building 535A
  Upton NY, 11973

  Homepage:    http://bruceravel.github.io/home/
  Software:    https://github.com/bruceravel
  Demeter:     http://bruceravel.github.io/demeter/

More information about the Ifeffit mailing list