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 :
- create an account at exelis
- navigate to Downloads / Product Downloads / IDL
- click 'Show Previous Versions'
- select IDL Version 8.1 appropriate for your platform, and click 'Product Download'
(except if you have a Mac with Lion, select IDL 8.2)- click two checkboxes: 'I have recently purchased...' and 'I agree to comply...'
- click 'Product Download' and select 'Save File'
- follow the instructions here to install on Windows, UNIX, Linux, and Mac
- save this license file to any location on your computer and follow the license wizard instructions to install it.
Note: this is a temporary full-function evaluation license that will expire on August 31, 2012.
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:
- select an SSW path for your system (if you set an explicit path, be sure to use a '\' for Windows, '/' indicates a UNIX/Linux/Mac installation)
- enter your email address in the SSW Site email contact box
- for Windows, choose the 'Don't worry' option for Perl location
- for Windows, check 'Enable daily upgrade task' if you're not on a laptop (which may not be on a network at night)
- select Packages: BINARIES (should already be checked by default), SPEX, XRAY, HESSI at a minimum, more if you want more SSW branches
- click 'Generate Installation Script'
- download the generated csh script (UNIX/Linux/Mac) or zip file (Windows)
- run the script to install SSW as follows. If successful, the final message will be 'Installation complete'
UNIX/Linux/Mac: csh -f scriptname (substituting the name of your script)
Note: if you are installing ssw into a root-owned location, you must run this command as root: sudo csh -f scriptname
Windows: Extract the contents of the zip file to an empty directory, and execute the setup.bat file.
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 necessaryFor 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/idlNotes:
- If you want the ssw setup to proceed quietly, replace /loud with /quiet.
- If you don't want the ssw setup to run every time you start a terminal, don't include the setup.ssw line in your .login (or whatever) file, and instead set an alias to run the setup before you use idl, e.g. alias setup_ssw "source $SSW/gen/setup/setup.ssw /loud", then type setup_ssw before starting ssw.
To start SSWIDL, type
- sswidl - runs in a terminal window, or
- sswidlde - runs in the IDL workbench (Eclipse graphical interface)
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 SSWIf 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:
- Click File / Select Input
- In the Select Input widget, click Browse / On remote sites...
- In the Select Time or Flare widget, enter times of interest or click Flare Selection to choose a flare, then click Search
- All files (spectrum and response) with the selected time will be displayed in list, with the four most-sunward highlighted. Click Accept and Close
The most sunward spectrum and response files will now be set in Select Time widget.- Click Plot Time Profile or Plot Spectrum to display data.
- Click Detector Angles to display information about angle of detector to Sun. If desired choose a different detector's spectrum and response file by clicking Browse / On this computer... (the four most-sunward were copied to your computer)
- If desired, click Change buttons to change energy or time bands for display.
- Proceed with File / Select Background, and File / Select Fit Options and Do Fit
- Use Plot_Control pulldown to modify display options, and use Window_Control to select panel to show
More complete guidance is available at Analyzing Fermi GBM Data and the OSPEX guide.
Last edited by Kim Tolbert, 12-Jul-2012 16:40