Hi Andrew,
On Mon, Nov 1, 2010 at 12:01 PM, Andrew Korinda
I'm looking to introduce some scripting routines to some of my EXAFS fitting work. Looking around I ran across the Python module and downloaded that. The shell works fine, as does enter commands directly into Ifeffit, however I'm not getting the read and write commands to work from within Python scripts.
Example: iff.ifeffit("read_data(C:\Program Files\Ifeffit\examples\Ifeffit\data\cu10k.chi,group=c)") returns -1.
This is almost certainly due to space in the filename, and is really more of a problem with the fortran than python (or perl for that matter). That is, with a space in the file name, you should explicitly use read_data(file=...., group=...) This should work better:: import Ifeffit iff = Ifeffit.Ifeffit() ret = iff.ifeffit("read_data(file=C:\Program Files\Ifeffit\examples\Ifeffit\data\cu.xmu, group=c)") If it doesn't, let use know.
From this experience I have some questions:
~First does anyone have some debugging tips for cross talk problems? The Fortran return values are fine, but would returning the echo_buffer or a log file be more helpful?
There should have been a printed message that might have altered you that the file hadn't been read in correctly: *** read_data: no file name given! was that message not given?
~Secondly, Does anyone have any example Python scripts for Ifeffit that they would like to share? I'm new to Python and haven't done programming for a while and I'd like to get a better idea of what's all possible, and how. I was looking at Matt Newville's message back in 2008 about defining a library for Athena in Python and his 2001 paper but couldn't find much else.
I sort of deliberately have left the base Ifeffit python module bare-bones. It would certainly be possible to add more functionality to that, or distribute add-on packages. It sort of depends what people would find desirable. I have many example scripts using Ifeffit + Python, mostly scripts, not documented, reliable code. Of course, there is also sixpack. I had some older GUIs as well. Would it be helpful to add some small examples on a wiki page?
~Finally, would I be better off coding in Perl and using Demeter?
That's a difficult question. The relative merits of Perl v Python are sort of a topic all on their own. For what it's worth, I believe (far) more people have used Python than Perl, but several very notable Ifeffit programs are written in Perl ;). --Matt PS: The next version of Ifeffit will be in python. Progress is slow, and when it will start to look like an EXAFS analysis program is a fair question. It probably shouldn't sway your decision much.