[Ifeffit] Small larch bug

Johan Nilsson johan.nilsson at chalmers.se
Fri May 27 06:21:50 CDT 2016


Hello,


I've found a small "bug" in larch when I tried to run the pre_edge function for some spectra. It seems that find_e0 will not accept a 2d 1-column array as input for energy or mu, and it gives a traceback which is quite difficult to decipher. Other functions like plot accepts these arrays without any problems, which made it a bit difficult to figure out what the problem was. Maybe there can be some some sort of warning if arrays have unexpected shapes, or an internal reshape if that works. I've attached a script that should give a minimum working example, my output is:


larch> run('cu.lar')
(612,)
8977.58
(612, 1)
  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/pre_edge.py", line 51, in find_e0
    dmu = np.gradient(mu)/np.gradient(energy)
  File "/usr/lib/python2.7/dist-packages/numpy/lib/function_base.py", line 918, in gradient
    out[slice1] = (f[slice2] - f[slice3])file cu.lar, line 14
IndexError: index 1 is out of bounds for axis 1 with size 1
    find_e0(e,cu.mu,group=cu)
  find_e0(e,cu.mu,group=cu)
file cu.lar, line 14
larch>


Best wishes,

Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20160527/2b65f8d6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cu.xmu
Type: application/octet-stream
Size: 20311 bytes
Desc: cu.xmu
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20160527/2b65f8d6/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cu.lar
Type: application/octet-stream
Size: 187 bytes
Desc: cu.lar
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20160527/2b65f8d6/attachment-0003.obj>


More information about the Ifeffit mailing list