[Ifeffit] Jupyter/python question for Larch
gbland at andrew.cmu.edu
Tue Aug 4 09:53:32 CDT 2020
I have a Python/Larch related question. I have been developing some python
script via jupyter and incorporating Larch as a module. I was able to read
an athena prj file with the following code
*import larch as lc*
*athena_prj = lc.io.read_athena(prjfilename)*
Python stores this object as a 'Group' object with each spectrum being an
instance. I would like to go through more processing with all spectra.
*for spectrum in athena_prj:*
* lc.xafs.find_e0(spectrum.energy, spectrum.mu <http://spectrum.mu>,
group = spectrum)*
This does not work since the 'Group' object is not iterable. I tried to
look up some other built-in functionality with python, but couldn't find an
efficient way other than manually typing out each spectrum
(athena_prj.spectrum1, athena_prj.spectrum2, .... etc). Is there any
built-in functionality in larch that can iterate this 'Group' object?
Any help would be appreciated. Thank you for your time!
Carnegie Mellon University
Civil and Environmental Engineering
Porter Hall 201
Pittsburgh, PA, 15213
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ifeffit