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.
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? ~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. ~Finally, would I be better off coding in Perl and using Demeter? Thanks everyone, Andy Korinda Notestein Lab Chemical & Biological Engineering Northwestern University
On Monday 01 November 2010 01:01:14 pm Andrew Korinda wrote:
~Finally, would I be better off coding in Perl and using Demeter?
Well, my opinion here is so very biased that I am better off leaving your question for others to answer. That said, Demeter is a very different beast from the Python wrapper. The Python and Perl wrappers are pretty much the same thing in that they give you direct access to the ifeffit command line from your script. Demeter does use the perl wrapper, but hides it under a mountain of additional functionality. Using Demeter, you do not interact in any direct way with Ifeffit. Instead you write programs using Demeter OO data structures and leave the interactions with Ifeffit and Feff up to the underlying libraries. If that sort of abstraction is attractive to you, then Demeter might be what you are looking for. If, however, you'd prefer to interact directly with Ifeffit, but with control structures and whatnot, then you will probably prefer to use one of the wrappers. Also Demeter is being actively developed -- in fact, I squished some bugs just last night! I use it for almost all of my own data analysis chores these days. In fact, I am getting very close to my first testing release of Athena and Artemis rewritten using Demeter. So, if you are interested, I'd love to have you give it a try. There is extensive (but not complete) documentation that comes when you download from the SVN repository. There are also also numerous "recipes" that come along when you download everything. HTH, B -- Bruce Ravel ------------------------------------ bravel@bnl.gov National Institute of Standards and Technology Synchrotron Methods Group at NSLS --- Beamlines U7A, X24A, X23A2 Building 535A Upton NY, 11973 My homepage: http://xafs.org/BruceRavel EXAFS software: http://cars9.uchicago.edu/~ravel/software/exafs/
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.
participants (3)
-
Andrew Korinda
-
Bruce Ravel
-
Matt Newville