- 积分
- 10605
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-10-10
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 longlivehj 于 2016-4-13 08:50 编辑
IDL8.5百度云网盘下载
Python Bridge
IDL now has a bridge from IDL to Python and Python to IDL. From your IDL code, you can now access any Python modules, transfer variables, and call built-in functions. Similarly, from your Python code, you can make IDL calls, transfer variables, and manipulate IDL objects. The bridge has the following features:
Works with Python 2.7+ and Python 3.4+
Access to all IDL routines and Python modules
Seamless: looks just like an IDL object or Python module
All bridge output is redirected to the standard output
Case sensitivity and row/column major is handled automatically
Can execute arbitrary command strings in either language
Automatic data conversion from IDL arrays to numpy arrays
Data is passed by reference when calling routines/methods
Can pass main variables back & forth
For example, within IDL, you could execute the following Python commands to create a matplotlib plot:
IDL> ran = Python.Import('numpy.random')
IDL> arr = ran.rand(100) ; call "rand" method
IDL> plt = Python.Import('matplotlib.pyplot')
IDL> p = plt.plot(arr) ; call "plot", pass an array
IDL> void = plt.show(block=0) ; pass keyword
Within IDL, you can also directly enter Python "command-line mode":
IDL> >>>
>>> import matplotlib.pyplot as plt
>>> import numpy.random as ran
>>> arr = ran.rand(100)
>>> p = plt.plot(arr)
>>> plt.show()
>>>
IDL>
On the Python side, you can easily access all IDL functionality:
>>> from idlpy import IDL
>>> import numpy.random as ran
>>> arr = ran.rand(100)
>>> p = IDL.plot(arr, title='My Plot')
>>> p.color = 'red'
>>> p.save('myplot.pdf')
>>> p.close()
|
|