Analyzing Fermi data using OSPEX

OSPEX is an IDL package for spectral analysis of solar data.  Through OSPEX, you can read and display data as a function of time or energy, subtract background, select time intervals of interest, select a combination of photon flux model components to describe the data, and fit those components to the spectrum in each time interval selected. Input to OSPEX is usually two files - one containing count spectra for one or many time intervals, and one containing a response matrix that relates the input photons to the observed counts. 

Limitations: OSPEX does not fit multiple instruments simultaneously. IDL is proprietary.

Fermi GBM spectral analysis is fully implemented in OSPEX.  We plan to enable Fermi LAT analysis in OSPEX as well once the data are available and we understand how to extract the solar and background data.

OSPEX is distributed in the SolarSoft (SSW) system.  To run OSPEX, you need

IDL is proprietary - see http://www.exelisvis.com.  In order to install IDL with full functionality, you need to purchase a license or have a network license available to you.  Several kinds of licenses are available for purchase, with cost ranging from hundreds to several thousands of dollars.  Discounts are available for educational and government institutions.  We will provide temporary licenses that will last for one month before and during the workshop.  In addition, during the workshop, network licenses will be available for use.

Perl and SSW are free.

Installation Instructions for IDL, SSW, and OSPEX

I. IDL Installation

Download and install IDL Version 8.1 for your platform (Linux, Window, or Mac, 32-bit or 64-bit) from http://www.exelisvis.com :

II. Perl

To see if Perl is already installed on your system, type perl -v (in a terminal window on Linux or Mac; from a command window on Windows  - open by clicking Start / Run and type cmd). If Perl is available, some lines of text will appear showing the Perl version. 

On UNIX/Linux,Mac, Perl is expected to be located at /usr/local/bin/perl.  If it's not there, put a symbolic link there pointing to where Perl actually resides using a command like
    ln -s /your_perl_path /usr/local/bin/perl. 

If Perl isn't on your system, download and install Perl from here: http://www.activestate.com/activeperl/downloads

III. SSW Installation

(Note: a detailed description of installing SSW on a Mac running Lion is provided here.)

View the full SSW installation description here, and/or follow the steps below

For all platforms, fill out the SSW Installation Form as follows:

IV. SSW Setup on UNIX, Linux, Mac

The following commands are required to define the environment variables SSW (points to top of your SSW tree) , SSW_INSTR (list of SSW instruments to use), and OS (only for Macs to identify the operating system) and execute the primary SSW setup script.  Usually they are added to a script that runs when you log in, such as your .login or .cshrc in your home directory.  They must be run in the C shell.

setenv SSW path_to_ssw_top
setenv SSW_INSTR 'instr1 instr2 instr3...'
source $SSW/gen/setup/setup.ssw  /loud
setenv OS xxx  (only needed on Macs)
setenv IDL_DIR xxx ( where xxx is the directory in the IDL installation containing the bin directory) - this setting may not be necessary

For example in your .login file, you might have:

setenv SSW /usr/local/ssw
setenv SSW_INSTR 'spex xray hessi'
source $SSW/gen/setup/setup.ssw  /loud
setenv OS Darwin   (or 'OSX', only needed on Macs)
setenv IDL_DIR /usr/local/itt/idl/idl

Notes:

To start SSWIDL, type

V. SSW Setup on Windows

 The $SSW/site/setup/sswidl.bat file (where $SSW is your top ssw directory) can be edited to specify a personal IDL startup script and to select SSW instruments  (must be a subset of those you installed).  Do NOT change the setting of the environment variable IDL_STARTUP  - that is the key to making  IDL run in the SSW environment. 

To start SSWIDL, navigate to the $SSW/site/setup directory and execute sswidl.bat .

VI. Keeping SSW Up-to-Date

On UNIX/Linux/Mac, use the ssw_upgrade procedure or create a cron job.

1. Run ssw_upgrade from within SSWIDL, for example,

IDL> ssw_upgrade, /spawn, /loud, /passive                      ; updates all instruments in SSW_INSTR list
IDL> ssw_upgrade, /gen, /xray, /spawn, /loud, /passive    ; update the gen and xray branches of SSW

If this fails, try it without the /passive (depends on your firewall settings).

2. Add an entry to your crontab file that looks like this (CHANGE the /ssw to reflect the top of your SSW tree):

30 2 * * * /ssw/gen/bin/ssw_batch go_update_ssw /ssw/site/setup/update_ssw.log

The go_update_ssw updates the SSW branches that are listed in $SSW/site/setup/setup.ssw_upgrade file.  If you want to add SSW branches that were not in your original installation, edit setup.ssw_upgrade to add more instruments.

On Windows, execute the $SSW/site/setup/Daily.bat file.  See more complete instructions for doing updates and adding SSW branches at http://hesperia.gsfc.nasa.gov/hessi/solar_install/installation.html

VII. OSPEX

Start OSPEX by starting an IDL SSW session and typing:

o=ospex()

That command brings up a GUI interface.  From here on, you can use the GUI or the command line to set parameters and initiate actions in OSPEX.  To get started in the GUI:

More complete guidance is available at Analyzing Fermi GBM Data and the OSPEX guide.

 

Last edited by Kim Tolbert, 12-Jul-2012 16:40