[Ifeffit] Scripting - Python

Matt Newville newville at cars.uchicago.edu
Thu Jul 14 12:50:57 CDT 2011


Hi Andrew,

Just as a follow-up, loading the Ifeffit library from python worked
for me on a separate Win7 machine (64bit).  I even had Ifeffit
installed to the non-default location. With Ifeffit installed to
C:\apps\Ifeffit, I edited C:\apps\Ifeffit\bin\use_ifeffit.bat to read

   @echo off
   SET IFEFFIT_DIR=C:\apps\Ifeffit\
   SET IFEFFIT_BIN=C:\apps\Ifeffit\bin
   SET PATH=%PATH%;%IFEFFIT_BIN%
   SET PGPLOT_DIR=%IFEFFIT_BIN%
   SET PGPLOT_DEV=/GW

Then from a command prompt:
    C:\>C:\apps\Ifeffit\bin\use_ifeffit
    C:\>python
    Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32
bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import Ifeffit
    >>> x  = Ifeffit.Ifeffit()
    >>> x.ifeffit('show $&build')
     $&build        = 1.2.11c Copyright (c) 2008 Matt Newville, Univ of Chicago

Does that work for you?  If not, can you send a more complete report
of your environmental variables?

Sorry for the trouble,

--Matt

On Thu, Jul 14, 2011 at 9:58 AM, Andrew Korinda
<a-korinda at northwestern.edu> wrote:
> Thanks Matt. That new binary was a great help. The install appears to
> have gone fine. I made the appropriate path changes in
> use_ifeffit.bat, ifeffit_config.py and ifeffit.py to reflect where I
> have installed Ifeffit. I noticed this when I was trying to debug an
> import error I get when I call ifeffit but this didn't solve the
> problem. The error I am getting is: ('failed to load ifeffit library
> ', 'C:\\Program Files (x86)\\Ifeffit\\bin\\ifeffit_12.dll') which is
> fatal. It's from line 125 of ifeffit.py. I've double check and the dll
> is there so I'm not sure why it is failing.
>
> I saw Joel.Brugger had the same issue on his Mac but I didn't see an
> email about that being resolved. Matt or anyone have another
> suggestion where I can look to debug this?
>
> Andy K.
>
> On Wed, Jul 13, 2011 at 2:53 PM, Matt Newville
> <newville at cars.uchicago.edu> wrote:
>> Hi Andrew,
>>
>> Sorry for not keeping these more up-to-date.  I posted windows
>> installers for Python 2.6 and Python 2.7 (sorry, no Python 3 support
>> yet) at
>>   http://cars.uchicago.edu/~ifeffit/src/PythonWrapper/
>>
>> I'll update the links on the wiki.
>>
>> Note that to use these well (especially for plotting fonts and colors
>> to work), you may have to run C:\Program
>> Files\Ifeffit\bin\use_ifeffit.bat, or otherwise set the environmental
>> variables given in that file.
>>
>> Cheers,
>>
>> --Matt
>>
>>
>> On Wed, Jul 13, 2011 at 10:41 AM, Andrew Korinda
>> <a-korinda at northwestern.edu> wrote:
>>> After a reprieve from XAS work, I'm back at it with a new laptop. In
>>> rebuilding the Ifeffit python package I realized I did not properly
>>> compile all the instructions which would explain why I wasn't getting
>>> things to return to the python shell such as echo messages. I am
>>> currently trying to properly install the Ifeffit wrapper from within
>>> ifeffit-1.2.11c.tar.gz onto Windows 7 and Python 2.7.2. Of course this
>>> has required some tweaks but when I get to "gcc.exe -mno-cygwin
>>> -shared -s build" the install crashes. I believe this has to do with
>>> site_install.py being writing for redhat and I'm not sure how to
>>> modify the directories for windows.
>>>
>>> Is there a way around this? I realize I could go back and install
>>> Python 2.5 and run Ifeffit-1.2.win32-py2.5.exe but that does mean
>>> going back and reinstalling every package (numpy, scipy, matplotlib,
>>> etc.) Is there maybe a way to rework Ifeffit-1.2.win32-py2.5.exe so it
>>> can be used on a machine with Python 2.7.2?
>>>
>>> Andy Korinda
>>>
>>> On Mon, Nov 8, 2010 at 12:36 AM, Andrew Korinda
>>> <a-korinda at northwestern.edu> wrote:
>>>> Thanks for the help. Sorry it took so long to report back but I can only do
>>>> must of my work on this on weekends. The corrected code worked great and I'm
>>>> moving forward again. No message was given when the code wasn't working.
>>>>
>>>> Andy Korinda
>>>>
>>>> On Nov 1, 2010 1:55 PM, "Matt Newville" <newville at cars.uchicago.edu> wrote:
>>>>
>>>> Hi Andrew,
>>>>
>>>> On Mon, Nov 1, 2010 at 12:01 PM, Andrew Korinda
>>>> <a-korinda at northwestern.edu> wrote:
>>>>> I'm looking t...
>>>>
>>>> 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 ...
>>>>
>>>> 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 shar...
>>>>
>>>> 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.
>>>>
>>>> _______________________________________________
>>>> Ifeffit mailing list
>>>> Ifeffit at millenia.cars.aps.anl.g...
>>>
>>> _______________________________________________
>>> Ifeffit mailing list
>>> Ifeffit at millenia.cars.aps.anl.gov
>>> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>>>
>>>
>>
>> _______________________________________________
>> Ifeffit mailing list
>> Ifeffit at millenia.cars.aps.anl.gov
>> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>>
>
> _______________________________________________
> 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