Fitting multiple intervals

From RHESSI Wiki

Revision as of 00:28, 12 September 2009 by Schriste (Talk | contribs)
Jump to: navigation, search

Contents

Fitting Multiple Intervals using the OSPEX 'Fit Options' GUI

Introduction

This section covers using the OSPEX 'Fit Options' GUI to fit multiple intervals. This document assumes that the user has a working knowledge of the procedure outlined in OSPEX GUI Users Guide for fitting a single interval. More information on looping options and control parameters can be found here

The 'Fit Options' GUI Looping Procedure

Once a single interval has been fit it may be of interest to the user to view how various parameters change with time. One way to do this is to fit a series of intervals individually, however this is a time consuming process. The 'Fit Options' GUI has a number of different ways to automatically fit a series of time intervals selected by the user. To start the process the 'Fit Options' GUI should appear as below:

Fit Options GUI after a single completed fit

In this case a single fit has been completed and we would like to fit subsequent intervals. There are a few choices we must make. The first is to select the intervals we would like to fit. We can do this by selecting the first interval in the series, then selecting the last interval while holding down the SHIFT key. All intervals between the two selected intervals will also be highlighted at this point.

Intervals to fit can be selected from the command line as follows:
obj -> set, spex_intervals_tofit = [4,5,6,7,9]
The interval numbers are the same as those defined when setting up the intervals in the [OSPEX GUI Users Guide].
The intervals are set from the lowest interval to the highest if the loop is set to forward or the opposite if the loop is
set to reverse (see below).
The interval numbers are automatically sorted from lowest to highest or highest to lowest depending on the loop direction.
Intervals can only be looped through in this order.

Our next is the loop mode. The 'Loop Mode' Button is on the left around the midpoint of the GUI. The loop mode determines how we will attempt to fit each interval in our selected series. The options are as follows:

Loop Mode Options

In most cases it is wise to choose Manual First + Automatic in order to be sure that the first fit in your series has physically
reasonable values before continuing with the rest of the fits automatically. From the command line this can be set by:
obj -> set, spex_fit_manual = 1 Other choices are 0 for automatic on all intervals or 2 for manual on all intervals 

The next choice is the loop direction. The 'Loop Direction' button is immediately to the right of the 'Loop Mode' button. This allows us to choose whether we want to start with the latest time and go backwards or start with the earliest time and go forwards. Accordingly the two options available are:

Loop Direction Options

This can be set from the command line as follows:
obj -> set, spex_fit_reverse = 0 spex_fit reverse can be set to 0 for forward or 1 for reverse

Now we must select our 'Parameter Initialization Method'. The choices for this are right below the 'Loop Mode' and 'Loop Directions' buttons. The 'Parameter Initialization Method' allows us to select the way in which starting parameters for each interval in the loop will be selected. It is broken up so we can select the starting parameters for the first interval fit by one method, then use a different method for the each subsequent interval. Our choices are as follows:

First Interval

Set the method to choose the initial parameters for the first interval fit from the command line as follows:
obj -> set, spex_fit_firstint_method = 'current' 
Other choices that can be used are default, fn, or sn. All options are defined here

Subsequent Intervals

Set the method to fit each subsequent interval after the first from the command line as follows:
obj -> set, spex_fit_start_method = 'previous_int'
Other choices that can be used are default, previous_start, previous_iter. All options are defined here

The parameter initialization method will set all the parameters from the start of each loop through each fit interval starting with the special case of the first interval and moving through all the subsequent intervals. However a fit option that can vary the greatly over the time of the loop is the 'energy range to fit'. In most cases we want to fit the entire energy range of the flare above the background level. If this energy range stays the same over the entire duration of the loop we can set it in the 'Change Fit Function Components and Set Parameters' GUI using the 'Change' button next to 'Energy range(s) to fit' at the bottom of the GUI.

From the command line, for example, we can set the erange by setting:
obj -> set, spex_erange = [6,40] where 6keV is the low end of the energy range and 40keV is the high end.

However in many cases the flare will extend to higher energies as it approaches it's peak time and the fall to lower energies as it decays. While looping we will not be able to adjust the energy range for each fit unless we do each fit manually. If we select the 'Auto-set Max' button at the bottom of the 'Change Fit Function Components and Set Parameters' GUI or below the list of time intervals in the 'SPEX Fit Options' GUI the high end of the energy range to fit will be automatically adjusted for each interval to the point where the spectrum reaches the background. This is not exact, the value is adjusted to nearest multiple of 10 in keV with a lower limit of 20keV. The low end of the energy range will remain fixed at the value to which it was set.

From the command line we can set the maximum of the enrange automatically by:
obj -> spex_fit_auto_erange = 1 the his sets the maximum to within 5keV of where the spectrum reaches the 
background level. 

Combinations of Looping Options

When fitting a flare there are many combinations of options that can be used when looping through fit interval, as described above. Some methods, and when they might advantageous to use, are discussed below.

Saving Results and Settings

Once a series of intervals have been fit, the results and settings can be saved in a script . Under the File drop down menu in the main OSPEX GUI select Write Script -> and Fit Results. A GUI will pop up which allows the user to select the name and path of the the script which contains the settings for the session. The file must be saved as a .pro file. Once this is done another window will appear allowing the user to select the name and path of the results file. This must be saved as a .fits file. When starting a new session the script can be used to set the options and results using the Set Parameters from Script -> Initialize All Parameters First option under the File drop down menu.

The script and results can also be saved from the command line:
obj -> writescript, outfile = 'xxx.pro', fit_outfile = 'xxx.fits'
Additional options for the writescript command can be found here
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox