This page was created by the IDL library routine `mk_html_help2`.

Last modified: Thu Sep 4 18:17:36 2025.

# Directory Listing of Routines

# general/missions/fast/fa_esa/functions

- ANGLE_TO_BINS
  Returns the angle "bins" array defined by "an" limits
- COLD_PEAK_2D
  Returns the energy of the energy flux peak due to cold electrons, eV
- CONTOUR2D
  Produces contour plots of pitch angle dist.s from 2D data structures.
- E_SEC_EFF
  Returns the fractional secondary electron flux with energy > pot
- EC_2D_NEW
  Returns the characteristic energy, Ec, eV
- ENERGY_TO_EBIN
  Returns the energy bin numbers in "dat.energy" nearest to "en"
- FU_FIT2D
- FU_SPEC2D
  Plots the differential funct(dat) versus energy, funct(dat) is integrated over angle only
- FUNCT_FIT2D
- GET_2DT
  To generate time series data for "tplot.pro"
- GET_EN_SPEC
  Generates energy-time spectrogram data structures for tplot
- GET_PA_SPEC
  Generates pitch angle vs. time spectrogram data structures for tplot
- GET_SP_SPEC
  Generates spin phase angle vs. time spectrogram data structures for tplot
- J_2D_NEW
  Returns the field aligned flux, Jz, #/cm^2-sec
- JE_2D_NEW
  Returns the field aligned energy flux, JEz, ergs/cm^2-sec
- JO_2D_NEW
  Returns the omin-directional flux, nv, 1/s-cm^2, corrects for spacecraft potential if dat.sc_pot exists
- N_2D_NEW
  Returns the density, n, 1/cm^3, corrects for spacecraft potential if dat.sc_pot exists
- OMNI2D
  Produces an energy or angle averaged data structure
- P_2D_NEW
  Returns the pressure tensor, [Pxx,Pyy,Pzz,Pxy,Pxz,Pyz], eV/cm^3
- PEAK_2D
  Returns the energy of the energy flux peak, eV
- PITCH2D
  Plots 2d data as pitch angle distributions.
- SPEC2D
  Plots 2d data as energy spectra.
- SUM2D
- T_2D_NEW
  Returns the temperature, [Tx,Ty,Tz,Tavg], eV
- V_2D_NEW
  Returns the velocity, [Vx,Vy,Vz], km/s

# Routine Descriptions

## ANGLE_TO_BINS

[Next Routine] [List of Routines]

    FUNCTION:	angle_to_bins(dat,an,EBIN=ebin)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    	an:	fltarr(2),	2D - min,max pitch angle limits (0-360 deg)
    		fltarr(2,2),	3D - array of (theta,phi) angle values
    				theta min,max (0,0),(1,0) -90<theta<90, thmin<thmax
    				phi   min,max (0,1),(1,1)   0<phi<360
    KEYWORD:
    	EBIN	int		optional, energy bin corresponding to "an"
    				used when angles depend upon energy bin
    PURPOSE:
    	Returns the angle "bins" array defined by "an" limits

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	96-4-25		J.McFadden
    	96-8-27		J.McFadden	Changed algorithm to include (mod 360.) and
    					handle arbitrary order in dat.theta or dat.phi

(See general/missions/fast/fa_esa/functions/angle_to_bins.pro)

## COLD_PEAK_2D

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	cold_peak_2d(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the energy of the energy flux peak due to cold electrons, eV
    NOTES:
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	04-8-12		J.McFadden

(See general/missions/fast/fa_esa/functions/cold_peak_2d.pro)

## CONTOUR2D

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE: contour2d,data
    PURPOSE:
    	Produces contour plots of pitch angle dist.s from 2D data structures.
    INPUTS:
       data   - structure containing 2d data  (obtained from get_fa_???() routine)
    		e.g. "get_fa_ees, get_fa_ies, etc."
    KEYWORDS:
    	LIMITS - A structure containing limits and display options.
                 see: "options", "xlim" and "ylim", to change limits
    	UNITS  - convert to given data units before plotting
    	MSEC - Subtitle will include milliseconds
    	TITLE - Title to be plotted,
    		- set title=' ' for NO Title!
    		- set title='1' for just the time in the title
    	XTITLE - xtitle to be plotted,
    		- set xtitle=' ' for NO xtitle!, default determined by VEL keyword
    	YTITLE - ytitle to be plotted,
    		- set ytitle=' ' for NO ytitle!, default=data.units_name
    	ZTITLE - ztitle to be plotted,
    		- set ztitle=' ' for NO ytitle!, default='Log!D10!N('+y_units+')'
    	RETRACE - set to number of retrace steps removed,
    		- typically set to 1 for FAST esas
    		- minus number will remove -(retrace) steps from end of sweep
    	VEL - If set, x-axis is velocity km/s  -- Default is Energy (eV)

    	NCONT - Number of contours to be plotted, default = 8
    	LEVELS - Explicit contour levels, default levels spaced down
    	         from max by 10^.5
    	FILL - If set, contours are filled with solid color or gray scale
    	BW - If set, contours are white, no affect on fill plots
    	PURE - If set, 6 pure colors are cycled through for levels
    	POLAR - Makes a polar plot
    	ROTATE - Exchanges x and y axes for non-polar plots
    	LABEL - Labels the contour levels
           LAB_0 - Puts 0 in center of plot (default is 90). Labels pitch angles with 90 degree increments.
           LAB_90 - Puts 90 in center of plot (default is 90). Labels pitch angles with 90 degree increments.
           LAB_180 - Puts 180 in center of plot (default is 90). Labels pitch angles with 90 degree increments.
           XMARGIN - Change xmargin from default
    	YMARGIN - Change ymargin from default

    See "pitch2d" for another means of plotting data.
    See "conv_units" to change units.

    CREATED BY:	J. McFadden  96-8-31
    FILE:  contour2d.pro
    VERSION 1.
    MODIFICATIONS:
    		McFadden 	96-9-3		More keywords added
    		Delory				Polar keyword
    		McFadden	97-11-20	Lab_0,LAB_180 keywords
    		McFadden	98-3-3		xmargin, ymargin keywords

(See general/missions/fast/fa_esa/functions/contour2d.pro)

## EC_2D_NEW

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	ec_2d_new((dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the characteristic energy, Ec, eV
    NOTES:
    	Function calls j_2d.pro and je_2d.pro
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden	04-10-22
    LAST MODIFICATION:
    	04-10-22		J.McFadden

(See general/missions/fast/fa_esa/functions/ec_2d_new.pro)

## ENERGY_TO_EBIN

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	energy_to_ebin(dat,en)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    	en:	real,fltarr,	real or float array of energy values
    KEYWORD:
    	BIN	int,intarr	optional, angle bins corresponding to "en"
    				used when energies depend upon angle bin
    PURPOSE:
    	Returns the energy bin numbers in "dat.energy" nearest to "en"

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	96-4-22		J.McFadden

(See general/missions/fast/fa_esa/functions/energy_to_ebin.pro)

## E_SEC_EFF

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	e_sec_eff(Te)
    INPUT:
    	Te:	flt,fltarr		electron temperature
    KEYWORDS
    	pot	flt,fltarr		if fltarr, then n_elements(pot)=n_elements(te), default pot=0
    	tmax	flt			algorithm parameter, default tmax = 2.283
    	aa	flt			algorithm parameter, default aa = 1.35
    	emax	flt			algorithm parameter, default emax = 325
    	kk	flt			algorithm parameter, default kk = 2.2
    	sec_max	flt			algorithm parameter, default sec_max=2.
    	te_sec	flt			algorithm parameter, default te_sec=2.

    PURPOSE:
    	Returns the fractional secondary electron flux with energy > pot
    NOTES:

    CREATED BY:
    	J.McFadden	09-05-31
    LAST MODIFICATION:

(See general/missions/fast/fa_esa/functions/e_sec_eff.pro)

## FUNCT_FIT2D

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE: funct_fit2d,dat

       Select energy/angle range and perform functional fit to data
       (default Maxwellian)
    INPUTS:
       	dat   	- data structure containing 2d data
    		- e.g. "get_fa_ees, get_fa_ies, etc."
    KEYWORDS:
    	NFITF	integer		optional number of functions for the
    	                        fit, default = 1
    	FITF	string		optional function for the fit, default
    	                        = maxwellian
    	AUTO	0/1		if set, defaults are used and peak
    	                        energy determined from the data
    	ENERGY:	fltarr(2),	optional, min,max energy range for fit
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers
    	                        for fit
    	EBINS:	bytarr(na),	optional, energy bins array for fit
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range
    	                        for fit
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers
    	                        for fit
    	BINS:	bytarr(nb),	optional, angle bins array for fit
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for
    	                        fit 0,1=exclude,include
    	LIMITS 	- A structure containing limits and display options.
                 	see: "options", "xlim" and "ylim", to change limits
    	UNITS  	- convert to given data units before plotting
    	F_UNITS - convert dat.data to given data units before
    			passing to function "FITF"
    	COLOR  	- array of colors to be used for each bin
    	LABEL  	- Puts bin labels on the plot if set.
    	SUMPLT - redraws the summed data and the fit after
    	         completion.
    	MSEC - Subtitle will include milliseconds

    NOTES:
    	This program still has bugs and may not weight the points
    	properly !!!!!

    	See "spec2d" for another means of plotting data.
    	See "conv_units" to change units.
    	See "time_stamp" to turn time stamping on and off.
    	 Future changes: fitfunct.pro, tempfit.pro, tempfit2.pro

    CREATED BY:	J. McFadden  96-11-14
    FILE:  funct_fit3d.pro
    VERSION 1.
    LAST MODIFICATION: Ver 1.1 GTDelory 97-07-30

(See general/missions/fast/fa_esa/functions/funct_fit2d.pro)

## FU_FIT2D

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION: fu_fit2d(dat,ENERGY=en,ERANGE=er,EBINS=ebins,...)

       Select energy/angle range and perform functional fit to data
       (default Maxwellian)
    INPUTS:
       	dat   	- data structure containing 2d data
    		- e.g. "get_fa_ees, get_fa_ies, etc."
    KEYWORDS:
    	NFITF	integer		optional number of functions for the
    	                        fit, default = 1
    	FITF	string		optional function for the fit, default
    	                        = maxwellian
    	AUTO	0/1		if set, defaults are used and peak
    	                        energy determined from the data
    	ENERGY:	fltarr(2),	optional, min,max energy range for fit
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers
    	                        for fit
    	EBINS:	bytarr(na),	optional, energy bins array for fit
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range
    	                        for fit
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers
    	                        for fit
    	BINS:	bytarr(nb),	optional, angle bins array for fit
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for
    	                        fit 0,1=exclude,include
    	LIMITS 	- A structure containing limits and display options.
                 	see: "options", "xlim" and "ylim", to change limits
    	UNITS  	- convert to given data units before plotting
    	F_UNITS - convert dat.data to given data units before
    			passing to function "FITF"
    	COLOR  	- array of colors to be used for each bin
    	LABEL  	- Puts bin labels on the plot if set.
    	SUMPLT - redraws the summed data and the fit after
    	         completion.
    	MSEC - Subtitle will include milliseconds

    NOTES:
    	This program still has bugs and may not weight the points
    	properly !!!!!

    	See "spec2d" for another means of plotting data.
    	See "conv_units" to change units.
    	See "time_stamp" to turn time stamping on and off.
    	 Future changes: fitfunct.pro, tempfit.pro, tempfit2.pro

    CREATED BY:	J. McFadden  96-11-14
    FILE:  funct_fit3d.pro
    VERSION 1.
    LAST MODIFICATION: Ver 1.1 GTDelory 97-07-30

(See general/missions/fast/fa_esa/functions/fu_fit2d.pro)

## FU_SPEC2D

[Previous Routine] [Next Routine] [List of Routines]

    PROGRAM:	fu_spec2d,funct,dat
    INPUT:
    	funct:	string,		function that operates on structures generated
    					by get_eesa_surv, get_eesa_burst, etc.
    				funct   = 'n_2d','j_2d','v_2d','p_2d','t_2d',
    					  'vth_2d','ec_2d', or 'je_2d'
    	dat:	structure,	2d data structures
    				example: dat = get_fa_ees(t)
    KEYWORDS
    	LIMITS - structure,	A structure containing limits and display options.
    				see: "options", "xlim" and "ylim", to change limits
    	TITLE - Title to be plotted,
    		- set title=' ' for NO Title!
    		- set title='1' for just the time in the title
    	XTITLE - xtitle to be plotted,
    		- set xtitle=' ' for NO xtitle!, default determined by VEL keyword
    	YTITLE - ytitle to be plotted,
    		- set ytitle=' ' for NO ytitle!, default=data.units_name
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	INTEG_F:	0,1	if set, plot forward integral
    	INTEG_R:	0,1	if set, plot reverse integral
    	MPLOT:		0,1	if set, mplot is used with blue (diff_fu), green (integ_f), and red (integ_r)

    PURPOSE:
    	Plots the differential funct(dat) versus energy, funct(dat) is integrated over angle only

    CREATED BY:
    	J.McFadden	97/03/13
    LAST MODIFICATION:  97/03/13
    MOD HISTORY:

    NOTES:
    	Current version only works for FAST

(See general/missions/fast/fa_esa/functions/fu_spec2d.pro)

## GET_2DT

[Previous Routine] [Next Routine] [List of Routines]

    PROGRAM:	get_2dt,funct,get_dat
    INPUT:
    	funct:	function,	function that operates on structures generated
    					by get_eesa_surv, get_eesa_burst, etc.
    				funct   = 'n_2d','j_2d','v_2d','p_2d','t_2d',
    					  'vth_2d','ec_2d', or 'je_2d'
    	get_dat, 	a string that defines the 'routine' that returns a 2D or 3D data structure
    			if 'probe' keyword set, assumes routine = get_dat
    			if 'probe' keyword is not set, assumes routine = 'get_'+ get_dat
    				unless get_dat already includes 'get_', in which case routine = get_dat
    			for example, get_dat='thc_peir' then routine = 'get_thc_peir'
    			for example, get_dat='thm_sst_pser' then routine = 'thm_sst_pser'

    KEYWORDS
    	T1:	real or dbl	start time, seconds since 1970
    	T2:	real or dbl	end time, seconds since 1970
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    	GAP_TIME: 		time gap big enough to signify a data gap
    				(def 200 sec, 8 sec for FAST)
    	NO_DATA: 	returns 1 if no_data else returns 0
    	NAME:  		New name of the Data Quantity
    				Default: funct+'_'+get_dat
    	BKG:  		A 3d data structure containing the background counts.
    	FLOOR:  	Sets the minimum value of any data point to sqrt(bkg).
    	MISSING: 	value for bad data.
    					0,1=exclude,include
    	CALIB:		Calib keyword passed on to get_dat -- no longer used
    	PROBE:		probe keyword passed on to get_dat -- used by themis sst routines

    PURPOSE:
    	To generate time series data for "tplot.pro"
    NOTES:
    	Program names time series data to funct+"_"+get_dat if NAME keyword not set
    		See 'tplot_names.pro'.

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:  97/03/04
    MOD HISTORY:
    		97/03/04	T1,T2 keywords added
    		08/07/10	bkg keyword changed to work for Themis ion ESA
    		08/12/31	bkg keyword changed to work for Themis electron sst
    		08/12/31	added probe keyword for themis sst calls
    		09/01/05	changed loop to use index to allow for dat.valid=0 data in stored data
    		09/01/05	calib keyword no longer passed to routine
    		09/04/16	bkg keyword removed for Themis electron sst, assume bkg removal is part of get_th?_pse?

    NOTES:
    	Current version only works for FAST

(See general/missions/fast/fa_esa/functions/get_2dt.pro)

## GET_EN_SPEC

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	get_en_spec
    PURPOSE:
    	Generates energy-time spectrogram data structures for tplot
    INPUT:
    	get_dat, 	a string that defines the 'routine' that returns a 2D or 3D data structure
    			if 'probe' keyword set, assumes routine = get_dat
    			if 'probe' keyword is not set, assumes routine = 'get_'+ get_dat
    				unless get_dat already includes 'get_', in which case routine = get_dat
    			for example, get_dat='thc_peir' then routine = 'get_thc_peir'
    			for example, get_dat='thm_sst_pser' then routine = 'thm_sst_pser'

    KEYWORDS:
    	T1:		start time, seconds since 1970
    	T2:		end time, seconds since 1970
    	ANGLE:		fltarr(2),fltarr(4)	angle range to sum over
    	ARANGE:		intarr(2)		bin range to sum over
    	BINS:		bytarr(dat.nbins)	bins to sum over
    	gap_time: 	time gap big enough to signify a data gap
    			(default 200 sec, 8 sec for FAST)
    	NO_DATA: 	returns 1 if no_data else returns 0
    	UNITS:		convert to these units if included
    	NAME:  		New name of the Data Quantity, default = get_dat + '_en_spec'
    	BKG:  		A 3d data structure containing the background counts
    			If bkg=1, it will run themis background subtraction routine
    	FLOOR:  	Sets the minimum value of any data point to sqrt(bkg).
    	MISSING: 	value for bad data.
    	RETRACE: 	Set to number of retrace energy steps to be eliminated starting at energy step 0
    	CALIB:		Calib keyword passed on to get_dat -- no longer used
    	PROBE:		probe keyword passed on to get_dat -- used by themis sst routines

    CREATED BY:	J.McFadden
    VERSION:	1
    LAST MODIFICATION:  97/03/04
    MOD HISTORY:
    		97/03/04	T1,T2 keywords added
    		97/05/22	CALIB keyword added
    		08/07/10	bkg keyword changed to work for Themis ion ESA
    		08/07/10	averaging routine changed to weight different angle bins by dat.gf
    		08/12/31	bkg keyword changed to work for Themis electron sst
    		08/12/31	probe keyword added for themis sst routines
    		09/01/05	changed loop to use index to allow for dat.valid=0 data in stored data
    		09/01/05	calib keyword no longer passed to routine
    		09/04/16	bkg keyword removed for Themis electron sst, assume bkg removal is part of get_th?_pse?

    NOTES:
    	Current version only works for FAST and THEMIS

(See general/missions/fast/fa_esa/functions/get_en_spec.pro)

## GET_PA_SPEC

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	get_pa_spec
    PURPOSE:
    	Generates pitch angle vs. time spectrogram data structures for tplot
    INPUT:
    	data_str, 	a string (either 'eesa_surv','ess', ...)
    			where get_'string' returns a 2D
    			pitch angle data structure
    KEYWORDS:
    	T1:		start time, seconds since 1970
    	T2:		end time, seconds since 1970
    	ENERGY:		fltarr(2)		energy range to sum over
    	ERANGE:		intarr(2)		energy bin range to sum over
    	EBINS:		bytarr(dat.nenergy)	energy bins to sum over
    	gap_time: 	time gap big enough to signify a data gap
    			(default 200 sec, 8 sec for FAST)
    	NO_DATA: 	returns 1 if no_data else returns 0
    	UNITS:		convert to these units if included
    	NAME:  		New name of the Data Quantity
    	BKG:  		A 3d data structure containing the background counts.
    	FLOOR:  	Sets the minimum value of any data point to sqrt(bkg).
    	MISSING: 	Value for bad data.
    	RETRACE: 	Set to number of retrace energy steps to be eliminated starting at energy step 0
    	CALIB:		Calib keyword passed on to get_"data_str"_ts
    	EWEIGHT		Weights the energy bin average by bin energy width.
    	SHIFT90		If set true, pitch angle range is -90 to 270

    CREATED BY:	J.McFadden
    VERSION:	1
    LAST MODIFICATION:  97/07/11
    MOD HISTORY:
    		96/08/14  	Added EWEIGHT keyword  - mcfadden
    		97/03/04	T1,T2 keywords added
    		97/07/11	CALIB keyword added
    		97/07/23	fixed bug - ind1=fix((max(ind)+min(ind))/2)

    NOTES:
    	Current version only works for FAST

(See general/missions/fast/fa_esa/functions/get_pa_spec.pro)

## GET_SP_SPEC

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	get_sp_spec
    PURPOSE:
    	Generates spin phase angle vs. time spectrogram data structures for tplot
    INPUT:
    	data_str, 	a string (either 'c1_hia_p6','c3_hia_p6', ...)
    			where get_'string' returns a 2D
    			pitch angle data structure
    KEYWORDS:
    	T1:		start time, seconds since 1970
    	T2:		end time, seconds since 1970
    	ENERGY:		fltarr(2)		energy range to sum over
    	ERANGE:		intarr(2)		energy bin range to sum over
    	EBINS:		bytarr(dat.nenergy)	energy bins to sum over
    	gap_time: 	time gap big enough to signify a data gap
    			(default 200 sec, 8 sec for FAST)
    	NO_DATA: 	returns 1 if no_data else returns 0
    	UNITS:		convert to these units if included
    	NAME:  		New name of the Data Quantity
    	BKG:  		A 3d data structure containing the background counts.
    	FLOOR:  	Sets the minimum value of any data point to sqrt(bkg).
    	MISSING: 	Value for bad data.
    	RETRACE: 	Set to number of retrace energy steps to be eliminated starting at energy step 0
    	CALIB:		Calib keyword passed on to get_"get_dat"_ts
    	EWEIGHT		Weights the energy bin average by bin energy width.
    	SHIFT90		If set true, pitch angle range is -90 to 270

    CREATED BY:	J.McFadden
    VERSION:	1
    LAST MODIFICATION:  97/07/11
    MOD HISTORY:
    		96/08/14  	Added EWEIGHT keyword  - mcfadden
    		97/03/04	T1,T2 keywords added
    		97/07/11	CALIB keyword added
    		97/07/23	fixed bug - ind1=fix((max(ind)+min(ind))/2)

    NOTES:
    	Current version only works for FAST

(See general/missions/fast/fa_esa/functions/get_sp_spec.pro)

## JE_2D_NEW

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	je_2d_new(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the field aligned energy flux, JEz, ergs/cm^2-sec
    NOTES:
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden		04-10-22
    LAST MODIFICATION:
    	04-10-22		J.McFadden
    	06-03-04	J.McFadden 	modified s/c pot to sc_pot*1.2 +1.
    	10-12-22	J.McFadden	this routine does not work for omni.pro generated distributions

(See general/missions/fast/fa_esa/functions/je_2d_new.pro)

## JO_2D_NEW

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	jo_2d_new(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the omin-directional flux, nv, 1/s-cm^2, corrects for spacecraft potential if dat.sc_pot exists
    NOTES:
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden	03-7-29
    LAST MODIFICATION:
    	04-12-29	J.McFadden 	modified s/c pot correction to be same as n_2d_new.pro
    	06-02-27	J.McFadden 	modified s/c pot to sc_pot*1.2 +1.
    	10-12-22	J.McFadden	this routine does not work for omni.pro generated distributions

(See general/missions/fast/fa_esa/functions/jo_2d_new.pro)

## J_2D_NEW

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	j_2d_new(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the field aligned flux, Jz, #/cm^2-sec
    NOTES:
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	03-07-17	J.McFadden  	modified from n_2d_new.pro
    	03-08-11	J.McFadden  	modified from n_2d_new.pro
    	03-08-13	J.McFadden	s/c pot calculated from e- spectra when dat.sc_pot>65.
    	06-03-04	J.McFadden 	modified s/c pot to sc_pot*1.2 +1.
    	10-12-22	J.McFadden	this routine does not work for omni.pro generated distributions

(See general/missions/fast/fa_esa/functions/j_2d_new.pro)

## N_2D_NEW

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	n_2d_new(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the density, n, 1/cm^3, corrects for spacecraft potential if dat.sc_pot exists
    NOTES:
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	96-4-22		J.McFadden
    	June 4, 2003	L.M.Peticolas
    	03-07-30	J.McFadden
    	03-08-13	J.McFadden 	s/c pot calculated from e- spectra when dat.sc_pot>65.
    	04-08-12	J.McFadden 	modified s/c pot calculated from e- spectra when dat.sc_pot>65.
    	04-10-12	J.McFadden 	modified s/c pot calculated from e- spectra when dat.sc_pot>65.
    	04-12-23	J.McFadden 	modified s/c pot calculated from e- spectra when dat.sc_pot>66.
    	06-03-04	J.McFadden 	modified s/c pot to sc_pot*1.2 +1.
    	07-10-23	J.McFadden 	modified s/c pot to (sc_pot+offset)*scale with default scale=1.2,offset=+1.
    	10-12-22	J.McFadden	modified to work for omni.pro generated distributions

(See general/missions/fast/fa_esa/functions/n_2d_new.pro)

## OMNI2D

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:  omni2d

    PURPOSE:
    	Produces an energy or angle averaged data structure
    	Summing is over pitch angle or energy, default is pitch angle summing.
     	This structure can be plotted with spec2d or pitch2d.

    KEYWORDS:
    	ANGLE:		intarr(n)		n=1 nearest angle to be summed
    						n=2 angle range to be summed
    						n>2 angle list to be summed
    	ARANGE:		intarr(2)		angle bin range to be summed
    	BINS   - 	bytarr(dat.nbins)	angle bins to be summed
    	ENERGY:		fltarr(2)		energy range to be summed
    	ERANGE:		intarr(2)		energy bin range to be summed
    	EBINS:		bytarr(dat.nenergy)	energy bins to be summed

     NOTE:	If no keyword is set, then sum over all angle to form energy spectrum

    CREATED BY:	J.McFadden
    LAST MODIFICATION:  97-3-3
    MOD HISTORY
    		97/03/03	ANGLE,ARANGE,ENERGY,ERANGE,EBINS keywords added

(See general/missions/fast/fa_esa/functions/omni2d.pro)

## PEAK_2D

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	peak_2d(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the energy of the energy flux peak, eV
    NOTES:
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	97-6-4		J.McFadden

(See general/missions/fast/fa_esa/functions/peak_2d.pro)

## PITCH2D

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE: pitch2d,data
    PURPOSE:
    	Plots 2d data as pitch angle distributions.
    INPUTS:
       data   - structure containing 2d data  (obtained from get_fa_???() routine)
    		e.g. "get_fa_ees, get_fa_ies, etc."
    KEYWORDS:
    	LIMITS - A structure containing limits and display options.
                 see: "options", "xlim" and "ylim", to change limits
    	UNITS  - convert to given data units before plotting
    	MSEC - Subtitle will include milliseconds
    	TITLE - Title to be plotted,
    		- set title=' ' for NO Title!
    		- set title=1 for just the time in the title
    	XTITLE - xtitle to be plotted,
    		- set xtitle=' ' for NO xtitle!, default determined by VEL keyword
    	YTITLE - ytitle to be plotted,
    		- set ytitle=' ' for NO ytitle!, default=data.units_name
    	RETRACE - set to number of retrace steps removed,
    		- typically set to 1 for FAST esas
    		- minus number will remove -(retrace) steps from end of sweep
    	COLOR  - array of colors to be used for each bin
    	ENERGY:		fltarr(2)		energy range to be plotted
    	ERANGE:		intarr(2)		energy bin range to be plotted
    	EBINS:		bytarr(dat.nenergy)	energy bins to be plotted
    	OVERPLOT  - Overplots last plot if set.
    	LABEL  - Puts bin labels on the plot if set.
    	ERROR_BARS - set to plot error bars
           PSYM - plot symbol added to lineplot

    See "spec2d", "contour2d" for another means of plotting data.
    See "conv_units" to change units.

    CREATED BY:	J. McFadden  96-8-26
    FILE:  pitch2d.pro
    VERSION 1.
    LAST MODIFICATION:  97/02/24
    MOD HISTORY:
    		97/02/24	MSEC keyword added,
    		98/08/19	PSYM keyword added,

(See general/missions/fast/fa_esa/functions/pitch2d.pro)

## P_2D_NEW

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	p_2d_new(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the pressure tensor, [Pxx,Pyy,Pzz,Pxy,Pxz,Pyz], eV/cm^3
    NOTES:
    	Function calls j_2d_new.pro and n_2d_new.pro
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	03-07-17	J.McFadden  modified from n_2d_new.pro
    	04-12-21	J.McFadden changed the s/c pot calculation to the same as n_2d_new.pro
    	06-03-04	J.McFadden 	modified s/c pot to sc_pot*1.2 +1.
    	10-12-22	J.McFadden	this routine does not work for omni.pro generated distributions

(See general/missions/fast/fa_esa/functions/p_2d_new.pro)

## SPEC2D

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE: spec2d,data
    PURPOSE:
       Plots 2d data as energy spectra.
    INPUTS:
       data   - structure containing 2d data  (obtained from get_fa_??() routine)
    		e.g. "get_fa_ees, get_fa_ies, etc."
    KEYWORDS:
    	LIMITS - A structure containing limits and display options.
                 see: "options", "xlim" and "ylim", to change limits
    	UNITS  - convert to given data units before plotting
    	MSEC - Subtitle will include milliseconds
    	TITLE - Title to be plotted,
    		- set title=' ' for NO Title!
    		- set title='1' for just the time in the title
    	XTITLE - xtitle to be plotted,
    		- set xtitle=' ' for NO xtitle!, default determined by VEL keyword
    	YTITLE - ytitle to be plotted,
    		- set ytitle=' ' for NO ytitle!, default=data.units_name
    	RETRACE - set to number of retrace steps removed,
    		- typically set to 1 for FAST esas
    		- minus number will remove -(retrace) steps from end of sweep
    	VEL - If set, x-axis is velocity km/s  -- Default is Energy (eV)

    	COLOR - array of colors to be used for each bin
    	ANGLE:		intarr(n)		n=1 nearest angle to be plotted
    						n=2 angle range to be plotted
    						n>2 angle list to be plotted
    	ARANGE:		intarr(2)		angle bin range to be plotted
    	BINS - 		bytarr(dat.nbins)	bins to be plotted
    	OVERPLOT - Overplots last plot if set.
    	LABEL - Puts bin labels on the plot if set.
    	LABSIZE - Change label size on plot.
    	NO_SORT - if set will prevent sorting by angle bin
    	ERROR_BARS - set to plot error bars
    	XMARGIN - change xmargin from default
    	YMARGIN - change ymargin from default
    	THICK - line thickness
    	PSYM - plot symbol added to lineplot

    See "pitch2d", "contour2d" for another means of plotting data.
    See "conv_units" to change units.

    CREATED BY:	J. McFadden	96-11-21	(from spec3d.pro)
    FILE:  spec2d.pro
    VERSION 1
    LAST MODIFICATION: 97/02/24
    MOD HISTORY:
    		97/02/24	MSEC keyword added,
    		98/03/4		xmargin,ymargin,thick keywords added
    		98/06/10	psym keyword added

(See general/missions/fast/fa_esa/functions/spec2d.pro)

## SUM2D

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION: sum2d
    PURPOSE: Takes two 2D structures and returns a single 2D structure
      whose data is the sum of the two
    INPUTS: d1,d2  each must be 3D structures obtained from the get_?? routines
    	e.g. "get_el"
    RETURNS: single 3D structure

    CREATED BY:	J. McFadden -- modified from D. Larson's sum3d.pro 96/06/27
    LAST MODIFICATION:
    		J. McFadden - added theta,gf,geom averaging

    Notes:

(See general/missions/fast/fa_esa/functions/sum2d.pro)

## T_2D_NEW

[Previous Routine] [Next Routine] [List of Routines]

    FUNCTION:	t_2d_new(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the temperature, [Tx,Ty,Tz,Tavg], eV
    NOTES:
    	Function calls p_2d_new.pro and n_2d_new.pro
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden
    LAST MODIFICATION:
    	03-07-17	J.McFadden  modified from n_2d_new.pro

(See general/missions/fast/fa_esa/functions/t_2d_new.pro)

## V_2D_NEW

[Previous Routine] [List of Routines]

    FUNCTION:	v_2d_new((dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins)
    INPUT:
    	dat:	structure,	2d data structure filled by get_eesa_surv, get_eesa_burst, etc.
    KEYWORDS
    	ENERGY:	fltarr(2),	optional, min,max energy range for integration
    	ERANGE:	fltarr(2),	optional, min,max energy bin numbers for integration
    	EBINS:	bytarr(na),	optional, energy bins array for integration
    					0,1=exclude,include,
    					na = dat.nenergy
    	ANGLE:	fltarr(2),	optional, min,max pitch angle range for integration
    	ARANGE:	fltarr(2),	optional, min,max angle bin numbers for integration
    	BINS:	bytarr(nb),	optional, angle bins array for integration
    					0,1=exclude,include,
    					nb = dat.ntheta
    	BINS:	bytarr(na,nb),	optional, energy/angle bins array for integration
    					0,1=exclude,include
    PURPOSE:
    	Returns the velocity, [Vx,Vy,Vz], km/s
    NOTES:
    	Function calls j_2d_new.pro and n_2d_new.pro
    	Function normally called by "get_2dt.pro" to generate
    	time series data for "tplot.pro".

    CREATED BY:
    	J.McFadden		05-05-07
    LAST MODIFICATION:
    	05-05-07		J.McFadden

(See general/missions/fast/fa_esa/functions/v_2d_new.pro)