Calling an GDL script in Python

1.3k views Asked by At

I'm an astronomer and just recived a lot, a LOT, of code writed on IDL, I use GDL to run it and works just fine (mostly), but I'm mainly a Ptyhon (2.7) user so would be nice to find a way to be able to call the IDL rutines from my Python scripts.

I'm aware of the idlpy bridge between IDL and Python, but it also works on GDL?

Thanks for the info

1

There are 1 answers

3
Steve G On BEST ANSWER

According to the GDL website, yes.

"GDL has also a Python bridge (Python code can be called from GDL; GDL can be compiled as a Python module)."

I haven't used it, so I can't say for sure whether or not it works, but here's what I found. The GDL documentation is rather bare, but does include some info. Calling Python from within GDL is briefly described on page 69. Calling GDL from Python is not documented there, though.

There's more info on using GDL from within Python on the GDL Github repository, including this example:

>>> import GDL
>>> print GDL.function("sin",(1,))
0.841470956802

And here's an example from elsewhere on the web:

>>> import numpy
>>> import GDL
>>> a = numpy.ndarray(10)
>>> GDL.pro("plot", a)