IDL在Jupyter中的集成
可能是由于版本问题,虽然成功把IDL的kernel集成进了jupyter,但是只能运行简单命令,最大的问题在调用函数时如果出错,会宕机。
尝试用IDL-Python Bridge来调用IDL程序。在IDL的IDE中,调用Python闪退,但是在Python中可以顺利调用IDL,而且能够在jupyter中输出error信息。
Python中调用IDL语法
from idlpy import IDL
IDL Version 8.5, Microsoft Windows (Win32 x86_64 m64).
(c) 2015, Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation.
Installation number: .
Licensed for use by:
调用IDL画图
把IDL当作了一个Python模块来使用
import numpy.random as ran
arr = ran.rand(100)
p = IDL.plot(arr,title = 'My PLOT')
p.color = 'red'
% Loaded DLM: PNG.
% Program caused arithmetic error: Floating illegal operand
% Program caused arithmetic error: Floating illegal operand
p.close()
调用MACS中的pro
IDL.readmacsfile()
% Compiled module: READMACSFILE.
% FILE_LINES: String expression required in this context: FILE2READ.
% Execution halted at: READMACSFILE 4 C:\Program Files\Exelis\IDL85\lib\dave\dave\programs\modules\MACS\readmacsfile.pro
% IDLNOTIFY
% $MAIN$
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-8-3c5ff1276bbb> in <module>()
----> 1 IDL.readmacsfile()
C:\Program Files\Exelis\IDL85\lib\bridges\idlpy.py in __call__(self, *args, **kw)
93 pyidl.callFunction("Resolve_Routine", (self.fn,),
94 {"QUIET":1, "EITHER":1, "NO_RECOMPILE":0})
---> 95 return pyidl.callFunction(self.fn, args, kw)
96 # If the user does IDL.MyThing.MySubthing, then assume that this is
97 # a static method call. Example: IDL.Clipboard.Get()
Exception: IDL error occurred.
首先输出了IDL中的错误,然后输出Python错误,前面部分和IDL中的输出错误一样。
但是可以看出readmacsfile在环境路径里,可以被直接调用编译,只是调用参数不全。