Re: IDL 8.5 Python Bridge [message #91698 is a reply to message #91616] |
Thu, 13 August 2015 11:16   |
PMallas
Messages: 2 Registered: June 2015
|
Junior Member |
|
|
On Thursday, August 6, 2015 at 12:46:15 PM UTC-4, Chris Torrence wrote:
> Hi all,
>
> As mentioned in my previous post, IDL 8.5 (now available unofficially) contains the new IDL Python bridge. I'll attach the "What's New" to the end of this post.
>
> The actual documentation for the Python bridge will be available on the website in a few weeks. It has a few updates (especially for configuration and the IPython notebook) that didn't make it onto the DVD. If you would like a copy now, please email me directly, chris <dot> torrence <at> harris <dot> com
>
> Also, we are looking for feedback on the Python configuration. Because both IDL and Python are large, we did not try to combine the two. You will need to install Python and Numpy (preferably from Anaconda) and then set several environment variables to get them to play nicely. Mac is especially tricky because Python has a lot of conflicts with the Macintosh system libraries. We'd like feedback on what worked (or didn't work) and how we can make it more streamlined in the future.
>
> Thanks!
>
> -Chris
>
>
> Here's the "What's New" page for the bridge:
>
> 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
> * IDL IPython Notebook Kernel
>
> 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()
This sounds great - I am very excited to check this out. Like many others here, I have been using python along with IDL.
Since you have decided to bridge these two languages, would it be possible to bridge the development environment too? Say, by integrating PyDev with your eclipse IDE? Seems like an easy thing to do and relieves someone like me from having to maintain an additional development environment just for python. Just a thought ....
|
|
|