在Python中调用一个IDL脚本 |
您所在的位置:网站首页 › idl读取图片 › 在Python中调用一个IDL脚本 |
问题描述
我想在 python 代码中运行 IDL 脚本,因为我需要稍后在 python 脚本中分析 IDL 代码的结果,但我不知道它是如何工作的.例如,我想在 python 代码中调用这个 IDL 脚本: pro plotgaussian, center, sigma, X=x, Y=y x = findgen(1000) / 999; numbers running 0 to 1 in steps of 0.001 x = x * 6 * sigma - 3 * sigma; widen x to range over 6 sigma x = x + center; center the x range on the bell curve center arg = ((x – center)/sigma)^2 y = exp(-arg) plot, x, y end我该怎么做? 推荐答案最新版本的 IDL (8.5) 原生支持这一点,它们提供了自己的双向桥接器,用于从 IDL 调用 Python 和从 Python 调用 IDL.他们的文档在这里:http://www.exelisvis.com/docs/pythontoidl.html 他们文档中的一些示例代码: >>> from idlpy import IDL >>> arr = IDL.findgen(100)/50*3.14159 >>> x = 50*IDL.sin(arr) >>> y = 50*IDL.cos(arr) >>> m = IDL.map(test=1) % Compiled module: MAP. >>> p = IDL.plot(x - 90, y, 'r-o2', overplot=1) % Compiled module: PLOT. >>> p = IDL.plot(x + 90, y, 'b-o2', overplot=1) >>> m.save('map.png', resolution=96, border=0, transparent=1)本文地址:https://www.itbaoku.cn/post/1806706.html?view=all |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |