Spectroscopy -- First Steps

 

                                   

 

4. Spectral Analysis Using SPEX.

Now let's start SPEX to produce a more accurate photon spectrum and obtain best-fit function parameters for the time intervals we have selected.

SPEX is completely independent from the GUI but the experts tell me that, just to be on the safe side, it's a good idea to close the GUI before you start SPEX so that there is no chance of any interference.

SPEX has its own independent command structure within the IDL/Solarsoft environment, but it does have some integration with RHESSI data analysis. We can use the hessi_spex routine to start SPEX with the correct data type and a reasonable default for the spectral file.

To start SPEX, type the following in the IDL command line:

IDL> hessi_spex

SPEX will put up two blank windows, one called the "Time History Window" the other the "Spectrum Window." It displays the following prompt in the IDL window:

SPEX>

At any time in SPEX, type "list" in the IDL command line to display a listing of all the commands that are available to SPEX and all the parameters that can be changed. Type "?,command" without the double quotes at any time to get an explanation of "command." Change options by entering item, comma, new value. After setting options, enter one of the available commands. Parameters and commands only need the shortest unambiguous abbreviation to be typed.They may be strung together by inserting !! between entries. To delete a string field, place a '' in the field.

There are two ways to obtain a printed version of any plot that SPEX generates. One way is to click in the window containing the plot and then press the Alt and Print Screen keys simultaneously. This will save a copy of the window in your Clipboard so that you can paste it into any program that can handle images (Word, PowerPoint, Irfanview, etc.) and generate a graphics file of the desired type. You can also produce a postscript file of the most recently generated plot with the create_ps command. To make it reproduce the plot in color, you need to enter the following two IDL commands first from within SPEX:

SPEX> idl, sps, /color
SPEX> idl, x
 

A postscript file is created in your IDL working directory with a name like "count_spectrum_100330_212509.ps" that can be displayed and printed using Ghostscript. To get such a postscript version into the standard image handling programs, you need Adobe's Distiller program to convert it into a pdf file and then Acrobat to extract the images to the Clipboard again.

If you should enter a command that causes SPEX to crash, you can almost always recover by typing "retall" at the IDL prompt and then restating SPEX as above. Generally, SPEX remembers where it was before the crash and you can continue on with the analysis.

You can always save your work to date by typing the command "save_event." Two files called summary.dat and spex_dflts.dat are written to your IDL working directory. They can be read back in by typing the command "restore_event."

First, type "list" in the IDL command window. You should get the following list of all the the commands that SPEX recognizes and all the parameters that can be changed at this point in the analysis:

  Spectral Analysis Executive (SPEX)
 
  START_TIME_DATA 01-Jan-79 00:00:00.000
  END_TIME_DATA 01-Jan-79 00:00:00.000
  QUIET 1
  CHECK_DEFAULTS 1
  DFLTS_FILE spex_dflts.dat
  DATA_TIPE HESSI ALLSEG
  _1FILE hsi_spectrum*.fits
  _2FILE  
  DIRECTORY  
  FLARE 0
  DET_ID 1
  COSINE 1.000000
  SOURCE_RADEC 0.000000 0.000000
  PSSTYLE PORTRAIT
 
Commands: /drm /fitting /interval /summary /time_history ? batse_menu
comments erase execute exit find_files hard idl initialize kleanplot list
merge_batse online preview pspreview reset_eventvrestore_dflts save_dflts
script steps_help stop tek zoom
 
Additional commands: / accum background_interval bspectrum build_drm
cal_restore cal_save ch_bands clear_ut count_spectrum create_ps
display_intervals enrange fitting force_apar graph multidrm nospec_bands
photon_spectrum read_drm recalibrate restore_event save_event select_interval
spec_bands t_hist_mode time_history
 
Change parameters or enter a command
 

Note that the commands that start with "/" put you into different sections of SPEX with additional command options. Once in the new section, you can always type "list" again to see the new set of commands that apply there. You get back to the starting section with the "/" command.

First, we'll tell SPEX that we're using RHESSI front-segment data instead of RHESSI data from all segments:

SPEX> data, hessi, front

If you had selected rear-segment data or both front and rear in the GUI, you would type data,hessi,rear or data,hessi,allseg respectively.

Now we'll tell it to read in the spectral file ("_1file") and response matrix file ("dfile") that we just created. You can cut the file names from your IDL working directory, where the GUI puts them by default, and paste them into the IDL command line. If the files you created are the only files in your working directory, you can enter:

SPEX> dfile,hsi_srm*.fits
 

If the files are not in the IDL working directory, then you must give the full path name. If the files are not the only files in the given directory, you must enter enough information to specify their names, or just enter their full names to keep matters simple.

SPEX> _1file, hsi_spectrum_20020220_110000.fits
SPEX> dfile, hsi_srm_20020220_110000.fits
 

Note that filenames do not require quotes.

You can preview the data to make sure that SPEX knows where to get the data and response matrix from as follows:

SPEX> preview
 

This should give the following response if everything is OK:

File C:\IDL_WORKING_DIRECTORY\hsi_spectrum_20020220_110000.fits found.
Data will be read from C:\IDL_WORKING_DIRECTORY\hsi_spectrum_20020220_110000.fits
Data file name returned: C:\IDL_WORKING_DIRECTORY\hsi_spectrum_20020220_110000.fits
Change parameters or enter a command
SPEX>
 

To plot a time history of the data that have been read in, enter

SPEX> graph
 

You should see a similar count-rate time history in the time history window that we saw in the GUI.


 


 

The default here is a linear scale. I prefer to display the count rate on a log scale so that you can more clearly see when the flare starts and ends, and when would be good intervals to choose for the background, particularly at the higher energies. This can be changed to a log scale by typing:

SPEX> th_ytype, 1
SPEX> th_yrange, 1.e-4, 1.e1
 

The last command adjusts the Y axis to match the range of fluxes plotted by changing the array th_yrange. The first number is the lower limit on the flux being plotted and the second number is the upper limit. Note that to see these parameters and verify that the changes have been accepted, you need to go to the time history section of SPEX by typing

SPEX> /time
SPEX> list
 

Four default energy bands will be plotted. These can be changed to the more standard bands by typing the following:

SPEX> energy_bands, 6,12,12,25,25,50,50,100
 

Change the multiplication factors that will be used for each band with the following command:

SPEX> scale_bands,1,1,1,1
 

Then, after typing "graph" you should see following time history:


 

 

Previous | Start | Next

 

 

Responsible NASA Official:
Brian Dennis
Web Design:
Merrick Berg

Solar Physics Laboratory, Goddard Space Flight Center

Space Science Laboratory, University of California Berkeley
 
Responsible Berkeley Official:
Hugh Hudson
Systems Admin:
Jon Loran

This page last updated: June 27, 2011