projects/themis/spacecraft/fields/LASP/
thm_qfit.pro
Routines
top source thm_qfit
thm_qfit, data, phs, phsf=phsf, es=es, ec=ec, zero=zero, do_sigma=do_sigma, sigma=sigma, period=period, slide=slide, n_fitpts=n_fitpts, out=out, max_err=max_err, bad_pts=bad_pts, fail=fail
FUNCTION: THM_QFIT, data, phs, phsf=phsf, es=es, ec=ec, zero=zero, do_sigma=do_sigma, sigma=sigma, period=period, slide=slide, n_fitpts=n_fitpts, out=out, max_err=max_err, bad_pts=bad_pts PURPOSE: User unfriendly fit routine. NOTE: REQUIRES CONTINUOUS BUFFERS! NOT FOR GENERAL USE. INPUT: data - REQUIRED. A DATA ARRAY - NOT A STRUCTURE! RECOMMEND: dat_in does not have NANS. One nan may destroy entire period. phs - REQUIRED. An array of phases. IMPORTANT! All phases must be valid! No NANs! KEYWORDS: period - INPUT. Fit period. DEFAULT = 4pi slide - NO LONGER AN OPTION! NOTE: Slide will be forced to be pi/2. n_fitpts - INPUT. Number of points per fit. DEFAULT = 64. do_sigma - OPTION. /do_sigma fills sigma. out - OPTION. /out fills bad_pts. NOTE: FOR OUTLYER REJECTION, SEE BELOW! max_err - INPUT. Maximum allowable error of bad_pts. DEFAULT=25 nT OUTPUT: phsf - OUTPUT. Phase of fit -> Time of fit. es - OUTPUT. Sin phase of fit. ec - OUTPUT. Cos phase of fit. zero - OUTPUT. Zero level of fit. sigma - OUTPUT. Deviation in nT. Only filled if /do_sigma bad_pts - OUTPUT. Deviation in nT. Only filled if /out CALLING: SEE ff_magdc for an example. MUST USE fa_fields_bufs, and ff_zero_crossing first. OUT-LYING POINTS REJECTION: The program must be iterated. For example, below shows one interation: ff_qfit,data,phs,phsf=phsf,es=es,ec=ec,zero=zero,/out, bad_pts=bad_pts data(bad_pts) = !values.f_nan index = where(finite(data), n_index) IF n_index GT 0 then BEGIN data = data(index) phs = phs(index) ff_qfit,data,phs,phsf=phsf,es=es,ec=ec,zero=zero ENDIF ELSE print, "Big trouble! No valid points." HISTORY: INITIAL VERSION: REE 97-10-05 Space Sciences Lab, UCBerkeley 2011-05-20: Added the keyword FAIL. Jianbao Tao (JBT), CU/LASP.
Parameters
- data
- phs
Keywords
- phsf
- es
- ec
- zero
- do_sigma
- sigma
- period
- slide
- n_fitpts
- out
- max_err
- bad_pts
- fail
File attributes
Modification date: | Thu Feb 13 16:42:36 2014 |
Lines: | 139 |