;+
;	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 $
;-
pro thm_get_efi_cal_pars, tbeg, tend, name, cal_pars=cal_pars

	; nominal EFI waveform calibration parameters;
	;	JWB, UCBSSL, 7 Feb 2007.
	cal_par_time = '2002-01-01/00:00:00'

	units_edc = 'V'	; <--- NOTE that E-field units are Volts!!!
	units_eac = 'V'	; <--- NOTE that E-field units are Volts!!!
	units_v = 'V'

	adc_factor = 1.0/float( 2L^16 - 1L)
	gain_v = 2.0*105.2*adc_factor
	gain_edc = 2.0*15.0*adc_factor
	gain_eac = 2.0*2.54*adc_factor

	switch strlowcase( name) of
		'vaf':
		'vbf':
		'vap':
		'vbp':
		'vaw':
		'vbw': begin
			gain = gain_v*(1.0 + fltarr( 6L))
			offset = fltarr( 6L)
			units = units_v
			break
		end
		'eff':
		'efp':
		'efw': begin
			gain = gain_edc*(1.0 + fltarr( 3L))
			offset = fltarr( 3L)
			units = units_edc
			break
		end
		else:	begin
			gain = !values.f_nan
			offset = !values.f_nan
			units = 'undefined'
		end
	endswitch

	cal_pars = { $
		cal_par_time:cal_par_time, $
		gain:gain, offset:offset, units:units $
	}

return
end