This page was created by the IDL library routine mk_html_help2.

Last modified: Sun Nov 11 12:37:48 2007.


Directory Listing of Routines


Routine Descriptions

BUTTERWORTH_FILTER_RESP

[Next Routine] [List of Routines]
function butterworth_filter_resp(f, fc, N)
purpose: Calculates the transfer function of an N-pole Butterworth filter
         with a given cutoff frequency Fc.
 Inputs: f    freqency in Hz
         fc   Cutoff frequency in Hz
         N    Number of poles (must be 1, 2 or 4)
 Output: complex transfer function at given frequencies

(See themis/spacecraft/fields/butterworth_filter_resp.pro)


SCM_CLEANUP_CCC

[Previous Routine] [Next Routine] [List of Routines]
FUNCTION: SCM_CLEANUP_CCC

PURPOSE: cleans 8 hertz and harmonic instrument noise from scm data using 
       superposed epoch analysis.
	The raw data is high pass filtered above 4 Hz and then averaging on
	this filtered data is performed to determine the noise.
	Returns de-noised data and stores tplot quantity of this data

INPUTS:requires 3-component single spacecraft data structure from thm_load_scm

OUTPUT: data structure of 3 component cleaned data

KEYWORDS:
  probe: use this keyword to specify spacecraft if other than 'a'
  clock: set keyword clock to base epoch on the 1 sec clock pulse closest to
         the start of the interval otherwise epoch is from the beginning of
         each interval

  ave_window: set keyword ave_window to define window length in seconds for
         averaging, Default 3 seconds in length
         note for technique to work the window length should be an integer
         multiple of the period of the noise
         that is being removed.

  min_num_windows: set keyword min_num_windows to define the minimum length
         of continuous data in terms of window lengths
         default is 10. The greater this number the more reliable the result.

  diagnostic: set keyword diagnostic to plot spectral data and to store the
         average noise, filtered (>4Hz) corrected signal,
         and corrected signal for the last continuous interval anlaysed

SIDE EFFECTS: in current version data preceding the epoch for each interval
         is discarded

HISTORY
Chris Chaston 9-May-2007
Modified by Olivier Le Contel 5th-July-2007
  in order to include it in thm_cal_scm_ccc.pro routine
  thm_cal_scm_ccc being a modified version of
  thm_cal_scm routine written by Ken Bromund and Patrcik Robert
Modified by Ken Bromund 27-Sept-2007
  for inclusion in TDAS (use time routines available in TDAS)

$LastChangedBy: kenb-mac $
$LastChangedDate: 2007-10-02 09:24:50 -0700 (Tue, 02 Oct 2007) $
$LastChangedRevision: 1645 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/scm_cleanup_ccc.pro $

(See themis/spacecraft/fields/scm_cleanup_ccc.pro)


SPIN_TONES_CLEANING_VECTOR_V5

[Previous Routine] [Next Routine] [List of Routines]
Procedure: spin_tones_cleaning_vec_v5

Purpose:  compute an averaged signal with a specified averaging window duration
          and substract this averaged signal to raw signal

keywords: none
 input :t_vec,VEC,wind_dur,samp_per
        t_vec is a time array
        VEC is a time vector
        wind_dur is the duration of the averaging,
        samp_per is the sample period of t_vec and VEC
 output :VEC_AV has the duration of VEC but is obtained by
                duplicating the average signal over one averaging window
                along the whole time period
                the average signal is obtained by summing all averaging
                windows within the whole time period
         VEC_CLEANED is equal to VEC-VEC_AV,
         nbwind is the number of averaging window within the whole time period,
         nbpts_cl is the number of points within the whole time period
                i.e. also the dimension of t_vec_cleaned and VEC_CLEANED
Example:
   spin_tones_cleaning_vector, t_vec,VEC,wind_dur,samp_per,$
                               t_vec_cleaned,VEC_AV,VEC_CLEANED,nbwind,nbpts_cl
Notes:
  This routine is (should be) platform independent.

History:
 12 june 2007, written by Olivier Le Contel

$LastChangedBy: kenb-mac $
$LastChangedDate: 2007-10-02 09:24:50 -0700 (Tue, 02 Oct 2007) $
$LastChangedRevision: 1645 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/spin_tones_cleaning_vector_v5.pro $

(See themis/spacecraft/fields/spin_tones_cleaning_vector_v5.pro)


THM_CAL_EFI

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_CAL_EFI

Purpose:  Converts raw EFI (V, EDC, and EAC waveform) data into physical quantities.

keywords:
   /VERBOSE or VERBOSE=n ; set to enable diagnostic message output.
		higher values of n produce more and lower-level diagnostic
		messages.
   datatype  - default setting is to calibrate all raw quantites and also
               produce all _0 and _dot0 quantities.
   probe     - defaults to all probes
   valid_names - print valid datatypes
   coord     - coordinate system of output.
keyword parameters for _dot0 computation:
   max_angle - maximum angle of B field to spin axis to calculate _dot0. 
               defaults to 80 degrees.
   min_bz    - minimum value of Bz.  Typical value is 2.0 nT.  No default.
               Not compatible with max_angle keyword.
   max_bxy_bz- maximum value of abs(bx/bz) or abs(by/bz).  Typical value is 5.
               Default is not to use this method.
   bz_offset - offset in nT that will be added to Z axis measurement of B.
   fgm_datatype - 'fgl', 'fgh', 'fgs' or 'fge'

Example:
   thm_cal_efi, probe='c'

Notes:
	-- fixed, nominal calibration pars used (gains and frequency responses), rather than proper time-dependent parameters.

 $LastChangedBy: jimm $
 $LastChangedDate: 2007-10-22 13:20:13 -0700 (Mon, 22 Oct 2007) $
 $LastChangedRevision: 1789 $
 $URL $

(See themis/spacecraft/fields/thm_cal_efi.pro)


THM_CAL_FBK

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_CAL_FBK

Purpose:  Converts raw FBK (Filter Bank)  data into physical quantities.
keywords:
  probe = Probe name. The default is 'all', i.e., calibrate data for all
          available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, 'fbh', 'fb1', 'fb2'.  default is
          'all', to calibrate all variables.
           due to some last minute changes it is required that you include
  both the raw and the calibrated datatype you want for this function
  to perform properly
  in_suffix =  optional suffix to add to name of input data quantity, which
          is generated from probe and datatype keywords.
  out_suffix = optional suffix to add to name for output tplot quantity,
          which is generated from probe and datatype keywords.
  /VALID_NAMES; returns the allowable input names in the probe and
  datatype variables
   /VERBOSE or VERBOSE=n ; set to enable diagnostic message output.
		higher values of n produce more and lower-level diagnostic messages.

Example:
   thm_cal_fbk

Notes:
	-- Changes between signal sources are handled;
		source info from HED data should be used to get actual units of a given spectrum.
	-- fixed, nominal calibration pars used (gains and frequency responses), rather than proper time-dependent parameters.

(See themis/spacecraft/fields/thm_cal_fbk.pro)


THM_CAL_FFT

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_CAL_FFT

Purpose:  Converts raw FFT (on-board FFT spectra) data into physical quantities.
keywords:
  probe = Probe name. The default is 'all', i.e., calibrate data for all
          available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, 'ffp_16', 'ffp_32',
  'ffp_64', 'ffw_16', 'ffw_32', or 'ffw_64'.  default is
          'all', to calibrate all variables.
  due to some last minute changes it is required that you include
  both the raw and the calibrated datatype you want for this function
  to perform properly

  in_suffix =  optional suffix to add to name of input data quantity, which
          is generated from probe and datatype keywords.
  out_suffix = optional suffix to add to name for output tplot quantity,
          which is generated from probe and datatype keywords.
  /VALID_NAMES; returns the allowable input names in the probe and
  datatype variables
   /VERBOSE or VERBOSE=n ; set to enable diagnostic message output.
		higher values of n produce more and lower-level diagnostic messages.


Example:
   thm_cal_fft

Notes:
	-- Changes between signal sources are handled;
		source info from HED data should be used to get actual units of a given spectrum.
	-- fixed, nominal calibration pars used (gains and frequency
    responses), rather than proper time-dependent parameters.

(See themis/spacecraft/fields/thm_cal_fft.pro)


THM_CAL_FGM

[Previous Routine] [Next Routine] [List of Routines]
procedure: thm_cal_fgm

Purpose: applies calibration to THEMIS fluxgate magnetometer data

         searches for the current calibration in ASCII file
         takes calibration that has time stamp before or at the start of the data
         converts data to nano Tessla
         applies the calibration
         corrects for phase shift from averaging before despinning

keywords:
  probe = Probe name. The default is 'all', i.e., calibrate data for all
          available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, 'fge', 'fgh', or 'fgl'.  default is
          'all', to calibrate all variables.
  in_suffix =  optional suffix to add to name of input data quantity, which
          is generated from probe and datatype keywords.
  out_suffix = optional suffix to add to name for output tplot quantity,
          which is generated from probe and datatype keywords.
  coord = apply thm_cotrans if output other
          than spinning spacecraft (SSL) is desired.

optional parameters:

         name_thx_fgx_in   --> input data (t-plot variable name)
         name_thx_fgx_hed  --> header information for input data (t-plot variable name)
         name_thx_fgx_out  --> name for output (t-plot variable name)
         pathfile          --> path and filename of the calibration file

keywords:
Example:
      tha_cal_fgm, probe = 'a', datatype= 'fgl'

Notes: under construction!!

Written by Hannes Schwarzl.
 $LastChangedBy: jimm $
 $LastChangedDate: 2007-11-08 15:27:30 -0800 (Thu, 08 Nov 2007) $
 $LastChangedRevision: 1996 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_cal_fgm.pro $
Changes by Edita Georgescu
eg 6/3/2007     - matrix multiplication
eg 30/3/2007   - keyword deleted, fgmtype determined from: name_thx_fgx_in
                - calibrates fgl,fgh,fge
                - calibrate only mode=0 data
 2007-03-30 Modified by Hannnes S to use multiple calibrations for a selected interval
            and use spinperiod from the statefile
            Search this string to see changes ;Hannes 30/3/2007
 2007-03-30 Modified by Hannnes S correction for filter delay removed
            Search this string to see changes: Hannes 05/21/2007

(See themis/spacecraft/fields/thm_cal_fgm.pro)


THM_CAL_FIT

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_CAL_FIT

Purpose:  Converts raw FIT parameter data into physical quantities.
keywords:
   /VERBOSE or VERBOSE=n ; set to enable diagnostic message output.
		higher values of n produce more and lower-level diagnostic messages.
   /ALL

Example:
   thm_cal_fit, /all

Notes:
	-- FGM range changes are not handled properly; RANGE=0 is assumed.
	-- fixed, nominal calibration pars used, rather than proper time-dependent parameters.
   -- time-dependent spinn axis offset implemented Hannes 05/25/2007
   -- fixed trouble reading cal files with extra lines at the end,
      jmm, 8-nov-2007
 $LastChangedBy: jimm $
 $LastChangedDate: 2007-11-08 15:27:30 -0800 (Thu, 08 Nov 2007) $
 $LastChangedRevision: 1996 $
 $URL $

(See themis/spacecraft/fields/thm_cal_fit.pro)


THM_CAL_SCM

[Previous Routine] [Next Routine] [List of Routines]
NAME:
 thm_cal_scm
PURPOSE:
 calibrate THEMIS SCM data

    The processing is done in 8  successive steps
 ----------- by default, processing stops after step 5.
 
     # 0: counts, NaN inserted into each gap for proper tplotting
     # 1: Volts,  spinning sensor system, with    DC field
     # 2: Volts,  spinning sensor system, without DC field[, xy DC field in nT]
     # 3: nTesla, spinning sensor system, without DC field
     # 4: nTesla, spinning SSL    system, without DC field
     # 5: nTesla, fixed DSL system, without DC field, filtered <fmin
     # 6: nTesla, fixed DSL system, with xy DC field

keywords:
  probe = Probe name. The default is 'all', i.e., calibrate data for all
          available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be calibrated/created.
          The default is 'scf', 'scp', and 'scw', that is, SCM full mode,
          particle burst mode and waves burst mode data, with no diagnostic
          outputs.
          Each mode of output has its own set of possible diagnostic outputs:
          'sc?_dc', 'sc?_misalign' and 'sc?_iano', where ? can be
          f, p or w.  To calibrate all modes loaded and create all diagnostic 
          outputs you can specify 'all'.
          diagnostic outputs: raw data in Volts, dc field, axis misalignment
          (angle between x and y axes in degrees),
          and iano (data quality flag).  Created with '_dc',
          '_misalign', and '_iano' suffixes, respectively.
  in_suffix =  optional suffix to add to name of input data quantity, which
          is generated from probe and datatype keywords.
  out_suffix = optional suffix to add to name for output tplot quantity,
          which is generated from probe and datatype keywords.
  trange= array[2] string or double.  Limit calibration to specified time range
 
  nk =    N points of the cal-convolution kernel, if set, this value will
          be used regardless of sample rate.
  mk =    If nk is not set, set nk to (sample frequency)*mk, where sample
          frequency is determined by the data. default 8 for scf, 4 for scp, 
          and 1 for scw.
  despin =classic despin algorithm. 0:off 1:on  Default is on.
n_spinfit=n spins to fit for misalignment, dc field calculation and 
          optionally despin.
 cleanup= type of cleanup (default is 'none'):
          'spin' for only spin tones (power ripples) cleanup,
          'full' for spin tones and 8/32 Hz tones
          'none' for no cleanup processes.
 wind_dur_1s = window duration for 8/32 Hz cleanup (has to be a multiple of 1s)
          default is 1.
 wind_dur_spin = spintone cleanup window duration as a multiple of the spin
          period. Default is 1.
 clnup_author = choice of cleanup routine (default is 'ole'):
          'ccc' to use scm_cleanup_ccc 
          'ole' to use spin_tones_cleaning_vector_v5 
  fdet =  detrend freq. in Hz.  Detrend is implemented by subtracting a boxcar 
          avg., whose length is determined by fdet.  
          Use fdet=0 for no detrending.  Default is fdet=0.
  fcut =  Low Frequency cut-off for calibration.  Default is 0.1 Hz.
  fmin =  Min frequency for filtering in DSL system.  Default is 0 Hz.
  fmax =  Max frequency for filtering in DSL system.  Default is Nyquist.
  step =  Highest Processing step to complete.  Default is step 5.
  dfb_butter = correct for DFB Butterworth filter response (defaut is true)
  dfb_dig = correct for DFB Digital fiter response (default is true)
  gainant = correct for antenna gain (default is true)
  blk_con = use fast convolution for calibration and filtering.  
          Block size for fast convolution will be equal to 
          (value of blk_con) * (size of kernel).  blk_con = 8 by default.
          set blk_con=0 to use brute-force convolution.
  edge_truncate, edge_wrap, edge_zero= Method for handling edges in
          step 3, cal-deconvolution.  For usage and exact specification of
          these keywords, see docs for IDL convol function.  Default is to
          zero data within nk/2 samples of data gap or edge.
  coord = coordinate system of output.  Step 6 output can only be in DSL.
  no_download=don't access internet to check for updated calibration files.
  dircal= If set to a string, specifies directory of calibration files.
          use /dircal or dircal='' to use calibration files in IDL source 
          distribution.  
  verbose=set to zero to eliminate output.  currently only works with 
          valid_names
valid_names=use /valid_names to print out values for probe, datatype, coord
          and return those in named variables passed in to corresponding 
          keywords.

optional parameters:

  thx_scx      --> input data (t-plot variable name)
  thx_scx_hed  --> header information for input data (t-plot variable name)

Example:
      tha_cal_fgm, probe = 'a', datatype= 'scp'

HISTORY:
 13-mar-2007, jmm, jimm@ssl.berkeley.edu
 June-2007, krb, Based on Patrick Robert's cowave_THEscmwf.f
 25-sept-2007, krb, kenneth.r.bromund@nasa.gov
   merged in changes to version 893, made on 16-jul-2007 by 
   olivier.LeContel@cetp.ipsl.fr, including Olivier Le Contel cleanup routine
   (spin_tones_cleaning_vector_v5) in thm_cal_scm 

$LastChangedBy: jimm $
$LastChangedDate: 2007-10-24 11:44:38 -0700 (Wed, 24 Oct 2007) $
$LastChangedRevision: 1805 $ 
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_cal_scm.pro $

(See themis/spacecraft/fields/thm_cal_scm.pro)


THM_COLLATE_INTERVALS

[Previous Routine] [Next Routine] [List of Routines]
Purpose: Takes a bunch of intervals from different data sources and
collates all intervals of the same source into a single vector(may be multidimensional)

keywords:
         r: an array of data with dimensions [time,samples,sources]
         s: an array of source s[i] indices should have the source index of [*,*,i]

         returns: an array with dimensions [time,samples,sources] but
         all sources will be unique(ie the size of the output sources
         will be <= the input sources)

Notes: --Used by thm_cal_fft,thm_cal_fbk
       --The returned data will be sorted according to source index in
       ascending order

(See themis/spacecraft/fields/thm_collate_intervals.pro)


THM_COMP_EAC_RESPONSE

[Previous Routine] [Next Routine] [List of Routines]
	Procedure:
		thm_comp_eac_response

	Purpose:
		Compute the voltage gain (magnitude only) as a function of frequency
	for the DFB EAC channels.

	Calling Sequence:
	thm_comp_eac_response, sensor, ff, resp

	Arguements:
		sensor	STRING, ignored.
		ff	FLOAT[ N], array of frequencies at which to compute the channel response.
		resp	float[ N], array of |voltage gain| vs. frequency.

	Notes:
	-- none.

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-28 18:00:35 -0700 (Thu, 28 Jun 2007) $
 $LastChangedRevision: 939 $
 $URL $

(See themis/spacecraft/fields/thm_comp_eac_response.pro)


THM_COMP_EFI_RESPONSE

[Previous Routine] [Next Routine] [List of Routines]
	Procedure:
		thm_comp_efi_response

	Purpose:
		Compute the voltage gain (magnitude only) as a function of frequency
	for a given THEMIS EFI sensor (SPB or AXB).

	Calling Sequence:
	thm_comp_efi_response, sensor, ff, resp

	Arguements:
		sensor	STRING, one of SPB or AXB.
		ff	FLOAT[ N], array of frequencies at which to compute the sensor response.
		resp	COMPLEX[ N], array of voltage gain vs. frequency.

	Notes:
	-- none.

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-28 18:00:35 -0700 (Thu, 28 Jun 2007) $
 $LastChangedRevision: 939 $
 $URL $

(See themis/spacecraft/fields/thm_comp_efi_response.pro)


THM_COMP_SCM_RESPONSE

[Previous Routine] [Next Routine] [List of Routines]
	Procedure:
		thm_comp_scm_response

	Purpose:
		Compute the voltage gain (magnitude only) as a function of frequency
	for a given THEMIS SCM sensor.

	Calling Sequence:
	thm_comp_scm_response, sensor, ff, resp

	Arguements:
		sensor	STRING, ignored.
		ff	FLOAT[ N], array of frequencies at which to compute the sensor response.
		resp	float[ N], array of |voltage gain| vs. frequency.

	Notes:
	-- none.

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-28 18:00:35 -0700 (Thu, 28 Jun 2007) $
 $LastChangedRevision: 939 $
 $URL $

(See themis/spacecraft/fields/thm_comp_scm_response.pro)


THM_DFB_DIG_FILTER_RESP

[Previous Routine] [Next Routine] [List of Routines]
 function thm_dfb_filter(f, fsamp)
  purpose: Calculates the transfer function for the DFB digital
           filters at a given sample rate.
   Inputs: f     frequency in Hz
           fsamp Sampling frequency of telemetry signal. 
                 level of DFB filtering will be calculated 
                 based on the raw sampling rate of the DC coupled SCM and EFI 
                 inputs (8192 S/s )
   Output: transfer function at given frequencies -- abs taken, since
           phase is adjusted for in L0->L1 processing.
   Author: Ken Bromund, as a wrapper around routines written by Chris Cully.

$LastChangedBy: kenb-mac $
$LastChangedDate: 2007-09-24 13:05:40 -0700 (Mon, 24 Sep 2007) $
$LastChangedRevision: 1620 $ 
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_dfb_dig_filter_resp.pro $

(See themis/spacecraft/fields/thm_dfb_dig_filter_resp.pro)


THM_FBK_DECOMPRESS

[Previous Routine] [Next Routine] [List of Routines]
Function: THM_FBK_DECOMPRESS

Purpose:  Decompresses DFB FBK spectral data.
Arguements:
	DATA, any BYTE data type (scalar or array), 8-bit compressed FBK band-pass amplitude estimates.
keywords:
   VERBOSE.
Example:
   result = thm_fbk_compress( data)

Notes:
	-- none.

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-28 17:13:14 -0700 (Thu, 28 Jun 2007) $
 $LastChangedRevision: 935 $
 $URL $

(See themis/spacecraft/fields/thm_fbk_decompress.pro)


THM_FFT_DECOMPRESS

[Previous Routine] [Next Routine] [List of Routines]
Function: THM_FFT_DECOMPRESS

Purpose:  Decompresses DFB FFT spectral data.
Arguements:
	DATA, any BYTE data type (scalar or array), 8-bit compressed FFT spectral estimates.
keywords:
   VERBOSE.
Example:
   result = thm_fft_compress( data)

Notes:
	-- Stub version, to allow for testing.

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-21 14:15:51 -0700 (Thu, 21 Jun 2007) $
 $LastChangedRevision: 834 $
 $URL $

(See themis/spacecraft/fields/thm_fft_decompress.pro)


THM_FFT_FREQ_BINS[1]

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

(See themis/spacecraft/fields/thm_fft_freq_bins.pro)


THM_FFT_FREQ_BINS[2]

[Previous Routine] [Next Routine] [List of Routines]
	Procedure:
		thm_fft_freq_bins

	Purpose:
		Given the sampling rate and number of bins, return the center frequencies
	of the FFT spectral estimate bins.

	Calling Sequence:
	thm_fft_freq_bins, rate=rate, nbins=nbins, cent_freq=cent_freq

	Arguements:
		rate	STRING, '8k' or '16k', indicating that the source sampling rate is 8192 or 16384 samp/s.
		nbins	INT, 16, 32, or 64; number of frequency bins in the FFT spectral estimate.

	Outputs:
		cent_freq	FLOAT[ nbins], center frequencies of bins in Hz.

	Notes:
	-- none.

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-28 17:58:19 -0700 (Thu, 28 Jun 2007) $
 $LastChangedRevision: 938 $
 $URL $

(See themis/spacecraft/fields/thm_fft_freq_bins.pro)


THM_GET_EFI_CAL_PARS

[Previous Routine] [Next Routine] [List of Routines]
	Procedure:
		thm_get_efi_cal_pars

	Purpose:
		Given the particular EFI waveform data type, and begin and end of the time interval,
	return the waveform RAW->PHYS transformation parameters.

	Calling Sequence:
	thm_get_efi_cal_pars, tbeg, tend, name, cal_pars=cal_pars

	Arguements:
		tbeg, tend	DOUBLE, time in seconds since THEMIS epoch.
		name	STRING, waveform data type indicator.
		cal_pars	STRUCT, see Notes below for elements.


	Notes:
	-- use of TBEG and TEND for time-dependent calibration parameters is not currently implemented!
	-- E-field gains and units are for voltages, not fields, since we have not deployed yet!
	-- Difference in gain between DC and AC coupled E-field data not implemented yet!
	-- Elements of cal_pars are as follows:
		gain,	FLOAT[ 3 or 6], gain of source channel at DC in (phys unit)/ADC.
		offset, FLOAT[ 3 or 6], offset of channel in ADC.

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-02-07 17:33:39 -0800 (Wed, 07 Feb 2007) $
 $LastChangedRevision: 324 $
 $URL $

(See themis/spacecraft/fields/thm_get_efi_cal_pars.pro)


THM_GET_FBK_CAL_PARS

[Previous Routine] [Next Routine] [List of Routines]
	Procedure:
		thm_get_fbk_cal_pars

	Purpose:
		Given the signal source, and begin and end of the time interval,
	return the filter bank RAW->PHYS transformation parameters.

	Calling Sequence:
	thm_get_fbk_cal_pars, tbeg, tend, fb_sel, cal_pars=cal_pars

	Arguements:
		tbeg, tend	DOUBLE, time in seconds since THEMIS epoch.
		fb_sel	INT, FilterBank source selection indicator.
		cal_pars	STRUCT, see Notes below for elements.


	Notes:
	-- use of TBEG and TEND for time-dependent calibration parameters is not currently implemented!
	-- E-field gains and units are for voltages, not fields, since we have not deployed yet!
	-- Elements of cal_pars are as follows:
		gain,	FLOAT, gain of source channel at 0 dB response in (phys unit)/ADC.
		freq_resp FLOAT[ 6], effective attenuation factor for source channel for each
			of the six FilterBank channels.

 $LastChangedBy: kenb-mac $
 $LastChangedDate: 2007-08-01 22:11:55 -0700 (Wed, 01 Aug 2007) $
 $LastChangedRevision: 1319 $
 $URL $

(See themis/spacecraft/fields/thm_get_fbk_cal_pars.pro)


THM_GET_FFT_CAL_PARS

[Previous Routine] [Next Routine] [List of Routines]
	Procedure:
		thm_get_fft_cal_pars

	Purpose:
		Given the signal source, and begin and end of the time interval,
	return the FFT RAW->PHYS transformation parameters.

	Calling Sequence:
	thm_get_fft_cal_pars, tbeg, tend, fft_sel, nbins, cal_pars=cal_pars

	Arguements:
		tbeg, tend	DOUBLE, time in seconds since THEMIS epoch.
		fft_sel	INT, FilterBank source selection indicator.
		nbins,	INT, number of frequency bins in spectrum (16, 32, 64).
		cal_pars	STRUCT, see Notes below for elements.


	Notes:
	-- use of TBEG and TEND for time-dependent calibration parameters is not currently implemented!
	-- E-field gains and units are for actual deployed boom lengths (CDE).
	-- Elements of cal_pars are as follows:

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-28 17:57:08 -0700 (Thu, 28 Jun 2007) $
 $LastChangedRevision: 937 $
 $URL $

(See themis/spacecraft/fields/thm_get_fft_cal_pars.pro)


THM_LOAD_EFI

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_LOAD_EFI

Purpose:  Loads THEMIS EFI data

keywords:
  probe = Probe name. The default is 'all', i.e., load all available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, can be an array of strings
          or single string separate by spaces.  The default is 'all'
  TRANGE= (Optional) Time range of interest  (2 element array), if
          this is not set, the default is to prompt the user. Note
          that if the input time range is not a full day, a full
          day's data is loaded
  level = the level of the data, the default is 'l1', or level-1
          data. A string (e.g., 'l2') or an integer can be used. 'all'
          can be passed in also, to get all levels.
  CDF_DATA: named variable in which to return cdf data structure: only works
          for a single spacecraft and datafile name.
  VARNAMES: names of variables to load from cdf: default is all.
  /GET_SUPPORT_DATA: load support_data variables as well as data variables
                      into tplot variables.
  /DOWNLOADONLY: download file but don't read it.
  /valid_names, if set, then this routine will return the valid probe, datatype
          and/or level options in named variables supplied as
          arguments to the corresponding keywords.
  files   named varible for output of pathnames of local files.
  /VERBOSE  set to output some useful info
  /no_download: use only files which are online locally.
  relpathnames_all: named variable in which to return all files that are
          required for specified timespan, probe, datatype, and level.
          If present, no files will be downloaded, and no data will be loaded.
  type: 'calibrated' or 'raw'
  coord: what coordinate system you would like your data in.
Example:
   thg_load_efi,/get_suppport_data,probe=['a', 'b']
Notes:

 $LastChangedBy: pcruce $
 $LastChangedDate: 2007-10-25 11:06:37 -0700 (Thu, 25 Oct 2007) $
 $LastChangedRevision: 1820 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_load_efi.pro $

(See themis/spacecraft/fields/thm_load_efi.pro)


THM_LOAD_FBK

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_LOAD_FBK

Purpose:  Loads THEMIS FilterBank data

keywords:
  probe = Probe name. The default is 'all', i.e., load all available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, can be an array of strings 
          or single string separate by spaces.  The default is 'all'
  TRANGE= (Optional) Time range of interest  (2 element array), if
          this is not set, the default is to prompt the user. Note
          that if the input time range is not a full day, a full
          day's data is loaded
  level = the level of the data, the default is 'l1', or level-1
          data. A string (e.g., 'l2') or an integer can be used. 'all'
          can be passed in also, to get all levels.
  type=   'raw' or 'calibrated'. default is calibrated.
  suffix= suffix to add to output data quantity (not added to support
  data)
  relpathnames_all: named variable in which to return all files that are
          required for specified timespan, probe, datatype, and level.
          If present, no files will be downloaded, and no data will be loaded.
          and/or level options in named variables supplied as 
          arguments to the corresponding keywords.
  files   named varible for output of pathnames of local files.
  CDF_DATA: named variable in which to return cdf data structure: only works
          for a single spacecraft and datafile name.
  VARNAMES: names of variables to load from cdf: default is all.
  /GET_SUPPORT_DATA: load support_data variables as well as data variables 
                      into tplot variables.
  /DOWNLOADONLY: download file but don't read it.
  /VALID_NAMES, if set, then this routine will return the valid
  probe, datatype
  /NO_DOWNLOAD: use only files which are online locally.
  /VERBOSE  set to output some useful info
Example:
   thg_load_fbk,/get_suppport_data,probe=['a', 'b']
Notes:

 $LastChangedBy: kenb-mac $
 $LastChangedDate: 2007-09-07 11:41:35 -0700 (Fri, 07 Sep 2007) $
 $LastChangedRevision: 1554 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_load_fbk.pro $

(See themis/spacecraft/fields/thm_load_fbk.pro)


THM_LOAD_FFT

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_LOAD_FFT

Purpose:  Loads THEMIS FFT spectra (ParticleBurst and WaveBurst) data

keywords:
  probe = Probe name. The default is 'all', i.e., load all available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, can be an array of strings 
          or single string separate by spaces.  The default is 'all'
  TRANGE= (Optional) Time range of interest  (2 element array), if
          this is not set, the default is to prompt the user. Note
          that if the input time range is not a full day, a full
          day's data is loaded
  level = the level of the data, the default is 'l1', or level-1
          data. A string (e.g., 'l2') or an integer can be used. 'all'
          can be passed in also, to get all levels.
  type=   'raw' or 'calibrated'. default is calibrated.
  suffix= suffix to add to output data quantity (not added to support
  data)
  relpathnames_all: named variable in which to return all files that are
          required for specified timespan, probe, datatype, and level.
          If present, no files will be downloaded, and no data will be loaded.
  files   named varible for output of pathnames of local files.
  CDF_DATA: named variable in which to return cdf data structure: only works
          for a single spacecraft and datafile name.
  VARNAMES: names of variables to load from cdf: default is all.
  /GET_SUPPORT_DATA: load support_data variables as well as data variables 
                      into tplot variables.
  /DOWNLOADONLY: download file but don't read it.
  /VALID_NAMES: if set, then this routine will return the valid
  probe, datatype and/or level options in named variables supplied as 
  arguments to the corresponding keywords.
  /NO_DOWNLOAD: use only files which are online locally.
  /VERBOSE  set to output some useful info
Example:
   thm_load_fft,/get_suppport_data,probe=['a', 'b']
Notes:

 $LastChangedBy: kenb-mac $
 $LastChangedDate: 2007-09-07 12:36:39 -0700 (Fri, 07 Sep 2007) $
 $LastChangedRevision: 1555 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_load_fft.pro $

(See themis/spacecraft/fields/thm_load_fft.pro)


THM_LOAD_FGM

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_LOAD_FGM

Purpose:  Loads THEMIS fluxgate magnetometer data

keywords:
  probe = Probe name. The default is 'all', i.e., load all available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, 'fge', 'fgh', or 'fgl'.  'all'
          can be passed in also, to get all variables.
  TRANGE= (Optional) Time range of interest  (2 element array), if
          this is not set, the default is to prompt the user. Note
          that if the input time range is not a full day, a full
          day's data is loaded
  level = the level of the data to read, the default is 'l1', or level-1
          data. A string (e.g., 'l2') or an integer can be used. 'all'
          can be passed in also, to get all levels.
  type=   'raw' or 'calibrated'. default is calibrated.
  coord=  coordinate system of output.  default is 'ssl'
  suffix= suffix to add to output data quantity (not added to support data)
  CDF_DATA: named variable in which to return cdf data structure: only works
          for a single spacecraft and datafile name.
  VARNAMES: names of variables to load from cdf: default is all.
  /GET_SUPPORT_DATA: load support_data variables as well as data variables
          into tplot variables.
  /DOWNLOADONLY: download file but don't read it.
  /no_download: use only files which are online locally.
  relpathnames_all: named variable in which to return all files that are
          required for specified timespan, probe, datatype, and level.
          If present, no files will be downloaded, and no data will be loaded.
  /valid_names, if set, then this routine will return the valid probe, datatype
          and/or level options in named variables supplied as
          arguments to the corresponding keywords.
  files   named varible for output of pathnames of local files.
  /VERBOSE  set to output some useful info, set to 0 to or 1 to reduce output.
Example:
   thg_load_fgm,probe=['a','b']
Notes:
  This routine is (should be) platform independent.

 $LastChangedBy: kenb-mac $
 $LastChangedDate: 2007-08-31 10:58:45 -0700 (Fri, 31 Aug 2007) $
 $LastChangedRevision: 1528 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_load_fgm.pro $

(See themis/spacecraft/fields/thm_load_fgm.pro)


THM_LOAD_FIT

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_LOAD_FIT

Purpose:  Loads THEMIS FIT data

keywords:
  probe = Probe name. The default is 'all', i.e., load all available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, can be an array of strings
          or single string separate by spaces.  The default is 'all'
  TRANGE= (Optional) Time range of interest  (2 element array), if
          this is not set, the default is to prompt the user. Note
          that if the input time range is not a full day, a full
          day's data is loaded
  level = the level of the data, the default is 'l1', or level-1
          data. A string (e.g., 'l2') or an integer can be used. 'all'
          can be passed in also, to get all levels.
  CDF_DATA: named variable in which to return cdf data structure: only works
          for a single spacecraft and datafile name.
  VARNAMES: names of variables to load from cdf: default is all.
  /GET_SUPPORT_DATA: load support_data variables as well as data variables
                      into tplot variables.
  /DOWNLOADONLY: download file but don't read it.
  /valid_names, if set, then this routine will return the valid probe, datatype
          and/or level options in named variables supplied as
          arguments to the corresponding keywords.
  files   named varible for output of pathnames of local files.
  /VERBOSE  set to output some useful info
Example:
   thg_load_fit,/get_suppport_data,probe=['a', 'b']
Notes:

 $LastChangedBy: jimm $
 $LastChangedDate: 2007-11-09 16:33:14 -0800 (Fri, 09 Nov 2007) $
 $LastChangedRevision: 2009 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_load_fit.pro $

(See themis/spacecraft/fields/thm_load_fit.pro)


THM_LOAD_SCM

[Previous Routine] [Next Routine] [List of Routines]
Procedure: THM_LOAD_SCM

Purpose:  Loads THEMIS SCM data

keywords:
  probe = Probe name. The default is 'all', i.e., load all available probes.
          This can be an array of strings, e.g., ['a', 'b'] or a
          single string delimited by spaces, e.g., 'a b'
  datatype = The type of data to be loaded, can be an array of strings 
          or single string separate by spaces.  The default is 'all'
  TRANGE= (Optional) Time range of interest  (2 element array), if
          this is not set, the default is to prompt the user. Note
          that if the input time range is not a full day, a full
          day's data is loaded
  level = the level of the data, the default is 'l1', or level-1
          data. A string (e.g., 'l2') or an integer can be used. 'all'
          can be passed in also, to get all levels.
  CDF_DATA: named variable in which to return cdf data structure: only works
          for a single spacecraft and datafile name.
  VARNAMES: names of variables to load from cdf: default is all.
  /GET_SUPPORT_DATA: load support_data variables as well as data variables 
                      into tplot variables.
  /DOWNLOADONLY: download file but don't read it.
  /no_download: use only files which are online locally.
  relpathnames_all: named variable in which to return all files that are
          required for specified timespan, probe, datatype, and level.
          If present, no files will be downloaded, and no data will be loaded.
  /valid_names, if set, then this routine will return the valid probe, datatype
          and/or level options in named variables supplied as 
          arguments to the corresponding keywords.
  files   named varible for output of pathnames of local files.
  /VERBOSE  set to output some useful info, set to 0 to or 1 to reduce output.
Example:
   thg_load_scm,level=1,/get_suppport_data,probe=['a', 'b']
Notes:
  This routine is (should be) platform independent.

 $LastChangedBy: kenb-mac $
 $LastChangedDate: 2007-08-31 10:58:45 -0700 (Fri, 31 Aug 2007) $
 $LastChangedRevision: 1528 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_load_scm.pro $

(See themis/spacecraft/fields/thm_load_scm.pro)


THM_SCM_DECONVO_VEC[1]

[Previous Routine] [Next Routine] [List of Routines]
 function thm_scm_fastconvol(a, kernel)
 purpose: a wrapper that gives a unified interface to convol and blk_con -
          Unlike convol, it implements convolution in the mathematical sense 
          while centering the kernel over each data point. center is at 
          n_elements(k)/2
          Unlike blk_con, it implements centering the kernel and the 
          /edge keywords
          Default is to zero the edges within n_elements(k)/2 of the edge.
 parameters: 
       a the data (floating point array).
       k the kernel to be convolved with the data (floating point array)
 keywords:
  edge_zero: pad beginning and ending of data with zero
  edge_truncate: pad beginning and ending of data with first/last value
  edge_wrap:  pad beginning and ending of data by wrapping data around edge.
  blk_con: if non-zero, set block size to blk_con times kernel size. if zero
           always use brute-force convolution.  Defaults to 8.
 Author:
    Ken Bromund Sept 18, 2007

 $LastChangedBy: kenb-mac $
 $LastChangedDate: 2007-10-02 09:24:50 -0700 (Tue, 02 Oct 2007) $
 $LastChangedRevision: 1645 $
 $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/thm_scm_deconvo_vec.pro $

(See themis/spacecraft/fields/thm_scm_deconvo_vec.pro)


THM_SCM_DECONVO_VEC[2]

[Previous Routine] [Next Routine] [List of Routines]
Name:
 thm_scm_deconvo_vec
Purpose:
 continuous calibration accomplished by 
 convolveing a signal with a kernel.
 The kernel is derived by taking the fft of the 
 inverse of the frequency reponse.  The  kernel is also constructed
 to account for any sample delay.
Inputs:
    xio: input/output waveform
    nbp: number of points in xio
     nk: number of points in kernel: power of 2.
     f1: low frequency
     f2: high frequency
     fe: sample frequency
gainant: gain function, such as thm_scm_gainant.  If gainant is an empty
         string, unity gain will be used.
     ix: antenna number (1,2,3)
pathfil: calibration file name
    tau: time correction
Keywords:
 edge_truncate
 edge_wrap
 edge_zero     same functionality as keywords of same name to convol()
 blk_con       if non-zero, use block convolution (fast FFT-based convolution)
               with a block size of the value of this keyword times the kernel
               size.  If data size is too small, it will revert to
               brute-force convolution.
 plotk         create diagnostic plots of the kernel and frequency response.

(See themis/spacecraft/fields/thm_scm_deconvo_vec.pro)


THM_SPINFIT

[Previous Routine] [Next Routine] [List of Routines]
procedure: thm_spinfit

Purpose: finds spinfits of field data

         finds A,B, and C fits for each period of data, over the entire day

required parameters:
  var_name_in = tplot variable name containing data to fit

keywords:
  sigma = If set, will cause program to output tplot variable with sigma for each period.
  npoints = If set, will cause program to output tplot variable with number of points in fit.
  spinaxis = If set, program will output a tplot variable storing the average over the spin axis dimension
             for each time period.
  median  = If spinaxis set, program will output a median of each period instead of the average.
  plane_dim = Tells program which dimension to treat as the plane. 0=x, 1=y, 2=z. Default 0.
  axis_dim = Tells program which dimension contains axis to average over. Default 0.  Will not
             create a tplot variable unless used with /spinaxis.
  min_points = Minimum number of points to fit.  Default = 5.
  alpha = A parameter for finding fits.  Points outside of sigma*(alpha + beta*i)
          will be thrown out.  Default 1.4.
  beta = A parameter for finding fits.  See above.  Default = 0.4
  phase_mask_starts = Time to start masking data.  Default = 0
  phase_mask_ends = Time to stop masking data.  Default = -1
  sun2sensor = Tells how much to rotate data to align with sun sensor.

Example:
      thm_spinfit,'th?_fg?',/sigma

Notes: under construction!!

Written by Katherine Ramer
 $LastChangedBy: kramer $
 $LastChangedDate: 2007-06-08 10:10:36 -0700 (Fri June 8, 2007) $
 $LastChangedRevision: 0 $
 $URL:

(See themis/spacecraft/fields/thm_spinfit.pro)


THM_UNPACK_HED

[Previous Routine] [Next Routine] [List of Routines]
Function: THM_UNPACK_HED
	thm_unpack_hed, data_type, hed_array

Purpose:  Unpacks data packed into HED data.

Arguements:
	DATA_TYPE	STRING, one of the L1 data types (eff, scp, fbk, etc.)
	HED_ARRAY	BYTE[ N, 16], array of header data.

keywords:
	None.

Example:
	get_data, 'tha_fit_hed', data=d_hed
   hed_data = thm_unpack_hed( 'fit', d_hed.y)

Notes:
	-- Returns int( 0) if requested DATA_TYPE is not implemented.
	-- Returns annonymous structure with variable elements if DATA_TYPE is recognized.
	-- Not all DATA_TYPEs are implemented; implemented data types (APIDs) listed below:
		FIT (on-board EFI and FGM spin fits, 410),
		FBK (FilterBank data, 440),
		EFI waveform (VA?, VB?, EF?; 441,442,443, 445,446,447, 449,44A,44B),
		SCM waveform (SCF, SCP, SCW; 444; 448; 44C),
		FGM waveform (FGL, FGH; 460, 461),
		FFT spectra (FFP, FFW; 44D, 44E).

 Modification History:
 Written by J Bonnell, 31 Jan 2007
 Modified by
  LeContel 2007-05-24 10:39  (Wed, 24 May 2007)
           Modification for reading scm and efw headers:
           speed = reform( dh[ *, 14]/16b)

 $LastChangedBy: jbonnell $
 $LastChangedDate: 2007-06-16 10:57:56 -0700 (Sat, 16 Jun 2007) $
 $LastChangedRevision: 794 $
 $URL $

(See themis/spacecraft/fields/thm_unpack_hed.pro)


TIME_DOMAIN_FILTER

[Previous Routine] [List of Routines]
function time_domain_filter

purpose: filter data in a tplot structure, assuming constant dt between points,
         returns filtered data in a new tplot structure.

usage
 new_data = time_domain_filter(data, freq_low, freq_high)

Parameters
 data : a structure with elements x and y for time and data, respectively, with
        time in seconds.
 freq_low: low cutoff freqency in Hz
 freq_high: high cutoff frequency in Hz

HISTORY
 Chris Chaston 9-May-2007 ?

$LastChangedBy: kenb-mac $
$LastChangedDate: 2007-10-02 09:24:50 -0700 (Tue, 02 Oct 2007) $
$LastChangedRevision: 1645 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_3_01/idl/themis/spacecraft/fields/time_domain_filter.pro $

(See themis/spacecraft/fields/time_domain_filter.pro)