# Presentation: 076850

## OSPEX – Object Spectral Executive

- OSPEX – new, but completely separate, object-oriented version of SPEX
- Documentation:
- Complete OSPEX Explanation
- _[List of OSPEX Control/Info Parameters](http://hesperia.gsfc.nasa.gov/ssw/packages/spex/doc/ospex_params_all.htm)_
- OSPEX First Steps
- Run OSPEX via
-   GUI
-   CLI
-   Combination of GUI and CLI
-   Batch script files
- Start OSPEX via
- o = ospex()    or     ospex_proc,o         Default is to start with GUI
- o = ospex(/no_gui)      or      ospex_proc,o, /no_gui

## OSPEX Input Options

- RHESSI Spectrum FITS File
-   Use spectrum object through GUI or CLI
-   Select finer time bins here for flexibility later
-   Include some background
-   Write output FITS file and associated SRM file
-   Set input file for OSPEX to spectrum FITS file
-   Set input SRM file for OSPEX to SRM FITS file
- RHESSI Image Cube FITS File
-   Use image object through GUI or CLI
- (hsi_multi_image object for now, hsi_image object soon)
-   Select multiple time bins and/or multiple energy bins
-   Write output FITS file
-   Set input file for OSPEX to image cube FITS file
-   You will be prompted to define the region to create spectrum from
- User Data
- Use set method from CLI to set spectrum data, errors, etc. See OSPEX Doc for details

## OSPEX Steps

- Select input data
- Select background time intervals
- Select fit time intervals
- Select fit function and starting parameters
- Select energy range to fit
- Select looping options
- Do fits
- Review fit results
- Write script to store your parameter settings
- Save fit results

## OSPEX GUI

- Starts by default but if you close it, type o -> gui
- Any of OSPEX sub-widgets can be used without using the main GUI
- OSPEX CLI
- OSPEX object design is identical to RHESSI objects
- OSPEX object is chain of objects, with an object for each type of data
- Uses SET, GET, GETDATA, PLOT, PLOTMAN methods
- To retrieve data from any object in the chain, use the class_name keyword
- Examples:
- To retrieve the raw data, use data = o -> getdata (class=‘spex_data’)
- To retrieve the background data, use bk = o -> getdata(class=‘spex_bk’)
- EXCEPT:  No getdata from top level, ,i.e. d = o ->getdata() not allowed.  This will be changed.

## pro ospex_script_demo, obj=o

- o = ospex()
- o->set, spex_specfile = 'c:\Analysis\working\hsi_spectrum_20020220_105002.fits'
- o->set, spex_drmfile = 'c:\Analysis\working\hsi_srm_20020220_105002.fits'
- o -> set, spex_bk_time_int = [['20-Feb-2002 10:56:23.040', '20-Feb-2002 10:57:02.009'], $
- 	['20-Feb-2002 11:22:13.179', '20-Feb-2002 11:22:47.820'] ]
- o->set, spex_eband=get_edge_products([3,22,43,100,240],/edges_2)
- o->set, spex_fit_time_inte = [ ['20-Feb-2002 11:06:03.259', '20-Feb-2002 11:06:11.919'], $
- 	['20-Feb-2002 11:06:11.919', '20-Feb-2002 11:06:24.909'], $
- 	['20-Feb-2002 11:06:24.909', '20-Feb-2002 11:06:33.570'] ]
- o->set, spex_erange=[19,190]
- o->set, fit_function='vth+bpow'
- o->set, fit_comp_param=[1.0e-005,1., .5, 3., 45., 4.5]
- o->set, fit_comp_free = [0,0,1,1,1,1]
- o->set, spex_fit_manual=0
- o->set, spex_autoplot_enable=1, spex_fitcomp_plot_resid=0
- o->dofit, /all
- o->fitsummary
- end

## Slide 6