projects/themis/examples/advanced/
thm_crib_spinfit.pro
includes main-level programBatch File: THM_SPINFIT Purpose: Demonstration of finding spin fit parameters for spinning data. The FIT module calculates the E-Field and B-Field vectors by taking 32 points at equal angles and fitting a sine wave least squares fit to the data. The best fit of the data is defined by the formula: A + B*cos() + C*sin(). The module calculates the standard deviation of the fit called Sigma, and the number of points remaining in the curve called N. Calling Sequence: Cut-and-paste the code to the command line. Arguments: 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. Notes: The module determines which data is more than xN * �N (sN = standard deviation) away from fit, and removes those points and repeats the fit. The second time the standard deviation is smaller so the tolerance is increased a bit. The tolerance xN varies with try as: Alpha*NBeta, where A=1.4 and Beta=0.4 provide good results. The operation continues until no points are outside the bounds and the process is considered convergent. Written by Katherine Ramer $LastChangedBy: Katherine Ramer$ $LastChangedDate: 2013-12-16 14:28:18 -0800 (Mon, 16 Dec 2013) $ $LastChangedRevision: 13677 $ $URL $
File attributes
Modification date: | Thu Feb 13 16:42:56 2014 |
Lines: | 13 |