Calling SSWIDL from a Python session



Calling SSWIDL from a Python session

Solarsoft is a mainly IDL codebase for the analysis of solar physics data.  To use Solarsoft, you need to setup the appropriate environment variables, etc in IDL and on your machine.  This setup is commonly referred to as SSWIDL, and that’s what I will call this from now on.

So, I’ve hacked some code together which will allow you to call an SSWIDL session from a Python of session.  The code comes in two parts:

  1. pIDLy – this is the package that does all the hard work establishing the connection between Python and IDL, written by Anthony Smith,
  2. pySSWIDL – some simple Python code I put together that turns the pIDLy IDL session into a SSWIDL session.

Download and install pIDLy as instructed.  Then download pySSWIDL and follow the instructions in the readme file.

If anyone has a smarter way of doing calling SSWIDL from inside a Python session, please let me know!


  • Shane
    Oct 25, 2011 at 3:05 am

    You can also just make a little shell script

    source .cshrc


    then in python

    import pidly
    idl = idl = pidly.IDL(‘path to script’)

  • jack
    Feb 28, 2012 at 2:19 pm

    Some small corrections….

    Create a script called ;

    source .cshrc

    Then make the script executable – for example, on Linux ‘chmod 777 ‘ will do the job.

    then in python

    >>> import pidly
    >>> idl = pidly.IDL(‘path to script’)

    and as a test to make sure that SSW IDL is being called, try:

    >>> idl(‘plot_image,findgen(10,10)’)

    This should pop up an IDL window with an image in it.

    Thanks, Shane!

  • Pingback: pIDLy and Macports | SunPy

Leave a Reply

Your email address will not be published. Required fields are marked *