X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 15 Apr 2019 04:35 PM by  Ben Castellani
Python Bridge: Cannot execute IDL-functions in Python
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Stefan



New Member


Posts:2
New Member


--
02 Apr 2019 02:54 AM
    We have setup our IDL on a Linux server. Running IDL.pro scripts are fine, no issues at all.

    But neither the Jupyter Notebook or the iPython-terminal will work with IDL-tools.

    I can execute simple commands from the examples:
    CODE:
    In [8]: IDL.run('arr = FINDGEN(100)')

    In [9]: IDL.run('help, arr', stdout=1)
    ARR FLOAT = Array[100]

    But when I want to use a Task or similar, this happens:
    In [14]: spec = IDL.fft_powerspectrum(arr, 0.1)
    % Attempt to call undefined function: 'FFT_POWERSPECTRUM'.
    % Execution halted at: $MAIN$
    ---------------------------------------------------------------------------
    IDLError Traceback (most recent call last)
    <ipython-input-14-a285c140d0b4> in <module>
    ----> 1 spec = IDL.fft_powerspectrum(arr, 0.1)

    /usr/local/harris/envi55/idl87/lib/bridges/idlpy.py in __call__(self, *args, **kw)
    286 result = pyidl.callFunction(self.fn, args, kw)
    287 err, output = IDLFinishCall()
    --> 288 if err: raise IDLError(output)
    289 return result
    290

    IDLError: % Attempt to call undefined function: 'FFT_POWERSPECTRUM'.

    The same thing happens when I try to run the included notebook made by Harris: See this image: https://imgur.com/xCdPptr

    Any idea what I can do? We are running IDL 8.7.2, Python 3.6.8

    Ben Castellani



    Basic Member


    Posts:130
    Basic Member


    --
    15 Apr 2019 04:35 PM
    The issue here is related to your IDL_PATH that is specifically occuring to your Jupyter environment. IDL functionality like FINDGEN and HELP are included in core IDL. Your example shows this working fine, which is expected. If IDL is running, those functions will be included by default.

    However, FFT_POWERSPECTRUM is not part of core IDL. That is contained in the /idl87/lib directory which must be included in your IDL_PATH. Otherwise, IDL will return the "Attempt to call undefined function" error.

    You can diagnose this issue by running this command in Pytnon>>> IDL.execute("print,!path")
    You are not authorized to post a reply.