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!

3 thoughts on “Calling SSWIDL from a Python session

  1. You can also just make a little shell script

    #!/bin/csh
    source .cshrc

    sswidl

    then in python

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

  2. Some small corrections….

    Create a script called ;

    #!/bin/csh
    source .cshrc
    sswidl

    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!

  3. Pingback: pIDLy and Macports | SunPy

Leave a Reply

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