comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL 8.5 Python Bridge
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
IDL 8.5 Python Bridge [message #91616] Thu, 06 August 2015 09:46 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
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()
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: generate kinematic data using IDL
Next Topic: Passing Arrays BY REFERENCE

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:21:21 PDT 2025

Total time taken to generate the page: 0.00483 seconds