[Ifeffit] Larch-0.9.24 with Python2

Matthias Filez Matthias.Filez at ugent.be
Tue Nov 4 11:07:24 CST 2014


Dear Matt,

Thanks for your reply.

I included the following line at the beginning of the example you just posted (after use_plugin_path('xafs')): use_plugin_path('wx')
and this is what I get if I run it:

Read ASCII File: <Group ascii_file examples/xafsdata/cu_rt01.xmu>
['array_labels', 'attrs', 'column_labels', 'data', 'energy', 'filename', 'header', 'i0', 'mu']
After pre-edge:
['array_labels', 'attrs', 'column_labels', 'data', 'dmude', 'e0', 'edge_step', 'energy', 'filename', 'flat', 'header', 'i0', 'mu', 'nnorm', 'norm', 'norm1', 'norm2', 'norm_c0', 'norm_c1', 'norm_c2', 'norm_c3', 'nvict', 'post_edge', 'pre1', 'pre2', 'pre_edge', 'pre_offset', 'pre_slope']
Traceback (most recent call last):
  File "Py_usinglarch.py", line 24, in <module>
    autobk(cu, rbkg=1.0, kweight=1, _larch=my_larch)
  File "/usr/local/lib/python2.7/dist-packages/larch/__init__.py", line 37, in wrapper
    return fcn(*args, **keywords)
  File "/usr/share/larch/plugins/xafs/autobk.py", line 187, in autobk
    fit.leastsq()
  File "/usr/local/lib/python2.7/dist-packages/larch/fitting/minimizer.py", line 395, in leastsq
    lsout = leastsq(self.__residual, self.vars, **lskws)
  File "/usr/local/lib/python2.7/dist-packages/larch/fitting/minimizer.py", line 222, in leastsq
    shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
ValueError: need more than 1 value to unpack

Matthias

________________________________________
Van: ifeffit-bounces at millenia.cars.aps.anl.gov [ifeffit-bounces at millenia.cars.aps.anl.gov] namens Matt Newville [newville at cars.uchicago.edu]
Verzonden: dinsdag 4 november 2014 13:41
Aan: XAFS Analysis using Ifeffit
Onderwerp: Re: [Ifeffit] Larch-0.9.24 with Python2

On Tue, Nov 4, 2014 at 4:39 AM, Matthias Filez <Matthias.Filez at ugent.be> wrote:
> Dear mailing list user,
>
> When running an example file of Larch-0.9.24 with Python2 on Ubuntu x86_64,
> the following error was reported.
>   File "Py_usinglarch.py", line 32, in <module>
>     autobk(xafsdat.energy, xafsdat.mu, rbkg=1.0, _larch=my_larch)
>   File "/usr/local/lib/python2.7/dist-packages/larch/__init__.py", line 37,
> in wrapper
>     return fcn(*args, **keywords)
>   File "/usr/share/larch/plugins/xafs/autobk.py", line 187, in autobk
>     fit.leastsq()
>   File "/usr/local/lib/python2.7/dist-packages/larch/fitting/minimizer.py",
> line 395, in leastsq
>     lsout = leastsq(self.__residual, self.vars, **lskws)
>   File "/usr/local/lib/python2.7/dist-packages/larch/fitting/minimizer.py",
> line 222, in leastsq
>     shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
> ValueError: need more than 1 value to unpack
>
> Is Larch-0.9.24 compatible with Python2 on Ubuntu x86_64? If not, what
> packages and dependencies could we install to make it work on Python2? Or is
> Larch-0.9.24 only compatible with Python3?
>
> Many thanks in advance,
> Matthias
>
> _______________________________________________
> Ifeffit mailing list
> Ifeffit at millenia.cars.aps.anl.gov
> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>

It would be helpful to post the full example script.    Larch
definitely runs with Python2 on all Linux platforms (and Windows and
Mac OSX). Testing with Python3 is minimal, and the graphics libraries
will probably need significant work to get working with Python3.

So, it *should* work. I can't tell what might be wrong just from the
traceback (perhaps there is no actual data in those arrays?).  But,
the script below does work for me.

--Matt

#
from larch import Interpreter, use_plugin_path

use_plugin_path('xafs')
from pre_edge import pre_edge
from autobk import autobk

use_plugin_path('io')
from columnfile import _read_ascii

my_larch = Interpreter()

fname = 'examples/xafsdata/cu_rt01.xmu'

cu = _read_ascii(fname, labels='energy mu i0', _larch=my_larch)
print 'Read ASCII File:', cu
print dir(cu)

pre_edge(cu, _larch=my_larch)
print 'After pre-edge:'
print dir(cu)

autobk(cu, rbkg=1.0, kweight=1, _larch=my_larch)
# or
# autobk(cu.energy, cu.mu, group=cu, rbkg=1.0, kweight=1, _larch=my_larch)

print 'After autobk:'
print dir(cu)
print cu.chi
##########
_______________________________________________
Ifeffit mailing list
Ifeffit at millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit



More information about the Ifeffit mailing list