
Derived spectra are generated using THM_PART_GETSPEC, a command line routine
for creating energy and/or angular spectra from ESA and SST data. A list of
routines detailing command line usage is given at the bottom of this document.
The variables created end in 'en_eflux' for energy spectra and 'an_eflux'
plus a suffix corresponding to the type of angular spectra ('phi','theta',
'pa', and 'gyro').  A user specified suffix can be appended to the end
of the default name(s).

Any number of probes or data types can be selected for
a given time.  The energy and/or angular ranges can be specified in the 
middle column.  Phi and theta values are specified in DSL coordinates.
Limiting phi, theta, or energy will remove the out of range bins from
the calculation regardless of the type of spectra being requested.

The "Start Angle" option specifies the start of the y-axis (phi). This is
useful to center the spectra plot on the y-axis at a particular phi angle.
If this keyword is not set, the y-axis starts at the first angle input to
the PHI keyword.

If the phi range is greater than 360 degrees (or the Start Angle set), 
then the phi bins at the beginning of the phi range are added and 
wrapped around the end of phi range. For example, if phi=[0,420], 
the phi bins corresponding to 0-60 degrees are appended to the top of 
the plot.

Pitch angle and gyrovelocity spectra are generated by gridding a globe 
in a field-aligned coordinate (FAC) system at regular intervals along 
pitch (latitude) and gyrovelocity (longitude) as specified by the 
Regrid options(described below). These FAC angle bins are then rotated back 
into the native DSL coordinates of the particle distribution data. The flux 
assigned to a given FAC angle bin is determined by native angle bin to which 
the center of FAC angle bin has been rotated. So if a FAC angle bin center 
is rotated into the 88th angle bin of the probe's particle distribution 
data, the flux for that FAC angle bin is the same as the flux in angle bin 
88 of the particle distribution data. This rotation occurs for each time 
sample of the probe's particle data.

The size of the FAC system grid is specified with the Regrid option, a two-
element array in which the first element of the array specifies the number
of grid elements in the gyrovelocity (longitudinal) direction while the second
element sets he number of grid elements in the pitch (latitudinal)direction 
(default is [16,8]). Increasing the number of elements in the FAC system grid 
will increase the accuracy of the pitch angle and gyrovelocity angle spectra 
as it decreases the degree to which the FAC bins overlap into one or more 
native distribution angle bin. Suitable numbers for m and n are numbers 
like 2^k. So far, k=2-6 has been tested and work. Other numbers will work 
provided 180/n and 360/m are rational.

The pitch angle and gyrovelocity min/max set the angle range of interest for 
the respective spectra plots similarly to the theta and phi min/max. Energy 
spectra may also be affected by pitch angle and gyrovelocity settings. 

The "Conversion to FAC" option specifies the second axis for the field aligned
coordinate system, necessary when plotting pitch angle or gyrovelocity spectra.
When calculating pitch angle and/or gyrovelocity spectra the data may need to
be de-gapped in order to calculate the rotation matrix. See THM_FAC_MATRIX_MAKE 
for more info. Degapping can be performed in the GUI using the data processing 
panel (Analysis > Data Processing...).

The "Normalize Spectrum" options will normalize the flux for each time sample 
in a spectra plot to values between 0 and 1.

The "Set Maximum Gap" options is very useful when you want to overlay burst 
mode spectra plots over full mode spectra in tplot. Set to a number of seconds 
that is less than the time gap of the burst data, but greater than the sample
interval of the underlying full mode data.  This way the time gaps between
the burst mode data won't be interpolated by SPECPLOT and cover up the full
mode data between the burst mode data. 

For information on SST mask removal and sun contamination removal see:
  thm_crib_sst_contamination.pro
  thm_crib_sst_calibration.pro

Other related cribsheets and files:
  thm_crib_part_getspec.pro
  thm_ui_part_getspec.txt  (command line help file)


NOTES:
  - All angles are in DSL coordinates
  - Theta input must satisfy: -90 < theta[0] < theta[1] < 90
  - Phi input must be specified in ascending order in degrees
    (e.g. [270, 450] or [-90, 90] to specify the 'daylight' 
     hemisphere in DSL coordinates).
