vec_math
Class LeastFourier

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by vec_math.AbstractAnalyser
                  extended by vec_math.LeastFourier
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, Analyser

public class LeastFourier
extends AbstractAnalyser

This analyser recursively fits fourier series like

   F_M = ΣMA_k*cos(2πf·k·t)+B_k*sin(2πf·k·t)
   
for increasing M to the data. It starts with the frequency estimated specified by the key KEY_FREQUENCY, or, if not given, tries to estimate the highest frequency from a CleanFourier periodogram focused on the highest peak. The order of the (partial) Fourier series fitted is either determined by KEY_ORDER, or by the stability criterium KEY_CONVERGENCE, which is the relative change in frequency for the step from M-1 to M. If the frequency change drops below this value, the order is reached.


Nested Class Summary
static class LeastFourier.File
          Use the fourier least-squares on file data.
protected  class LeastFourier.FourierAmoeba
          An amoeba for solving least-squares to fourier series.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static double DEFCONVERGENCE
          Default frequency convergence criterium.
private static boolean DEFVISUALIZEALL
          Default visualize all/
static String KEY_CONVERGENCE
          If frequency is stable to this number, series stop.
static String KEY_FREQUENCY
          The key for the principal frequency, no default.
static String KEY_ORDER
          The key for the maximum Fourier series order, no default
static String KEY_VISUALIZEALL
          If true return all residuals, not just highest order.
private  List<VectorG> valid
          The solutions, ordered for increasing order in the series.
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
LeastFourier(Map<String,String> prop)
          Creates a new phase dispersion minimizer.
 
Method Summary
 long[] functionCalls(VectorG[] in)
          No estimate possible.
 Object[] metadata(VectorG[] in, VectorG[] allfits, VectorG[] p)
          Metadata are the fitting Fouries plus RMS in the following sense.
 VectorG[] process(VectorG[] in)
          Processes the data until we reach either KEY_ORDER in the Fouriere series expansion, or the frequency is stable to KEY_CONVERGENCE.
 double significance(double f, VectorG[] data, VectorG[] fit, VectorG[] residual)
          No significance yet.
 VectorG[] visualize(VectorG[] in, VectorG[] allfits)
          Visualized data is the original data minus the highest-order Fourier fit.
 
Methods inherited from class vec_math.AbstractAnalyser
getBootstrapData, getBootstrapData, getDiminishedData, getDiminishedData, getSyntheticData, getSyntheticData, reset, runningAverage
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.Initializable
init
 

Field Detail

KEY_FREQUENCY

public static final String KEY_FREQUENCY
The key for the principal frequency, no default.

See Also:
Constant Field Values

KEY_ORDER

public static final String KEY_ORDER
The key for the maximum Fourier series order, no default

See Also:
Constant Field Values

KEY_CONVERGENCE

public static final String KEY_CONVERGENCE
If frequency is stable to this number, series stop.

See Also:
Constant Field Values

KEY_VISUALIZEALL

public static final String KEY_VISUALIZEALL
If true return all residuals, not just highest order.

See Also:
Constant Field Values

DEFCONVERGENCE

public static final double DEFCONVERGENCE
Default frequency convergence criterium.

See Also:
Constant Field Values

DEFVISUALIZEALL

private static final boolean DEFVISUALIZEALL
Default visualize all/

See Also:
Constant Field Values

valid

private List<VectorG> valid
The solutions, ordered for increasing order in the series.

Constructor Detail

LeastFourier

public LeastFourier(Map<String,String> prop)
Creates a new phase dispersion minimizer.

Method Detail

process

public VectorG[] process(VectorG[] in)
Processes the data until we reach either KEY_ORDER in the Fouriere series expansion, or the frequency is stable to KEY_CONVERGENCE. Each iteration produces a fit in the resulting data vector, so the dimension of the processed VectorG is 1+order. The original data is not part of the processed data.

Parameters:
in - The measured data.
Returns:
Processed data of the same length as input data.

functionCalls

public long[] functionCalls(VectorG[] in)
No estimate possible.

Returns:
null If unknown.

visualize

public VectorG[] visualize(VectorG[] in,
                           VectorG[] allfits)
Visualized data is the original data minus the highest-order Fourier fit. If the KEY_VISUALIZEALL is set to true, we return all fits.

Specified by:
visualize in interface Analyser
Overrides:
visualize in class AbstractAnalyser
Parameters:
in - The measured data.
allfits - The processed data from Analyser.process(vec_math.VectorG[]).
Returns:
Visualizable data derived from processed one.

metadata

public Object[] metadata(VectorG[] in,
                         VectorG[] allfits,
                         VectorG[] p)
Metadata are the fitting Fouries plus RMS in the following sense. We return an VectorG array with a vector for each series solution. Each solution vector has the data RMS (measured-model fit) in the zeroth coordinate, the frequency on index one, followed by the amplitudes, first to the cosines, then sines. For ease of printout, all returned x_{\mathrm{rms}} = \sqrt {{1 \over n} \sum_{i=1}^{n} x_i^2} = \sqrt {{x_1^2 + x_2^2 + \cdots + x_n^2} \over n} vectors are augmented to have the dimensionality of 2*order+2.

Parameters:
in - The original data, before process.
allfits - The processed data from Analyser.process(vec_math.VectorG[]).
p - The visualized data from Analyser.visualize(vec_math.VectorG[], vec_math.VectorG[]).

significance

public double significance(double f,
                           VectorG[] data,
                           VectorG[] fit,
                           VectorG[] residual)
No significance yet.

Parameters:
f - The value whose significance is to be probed.
data - The original data, before process.
fit - The processed data from Analyser.process(vec_math.VectorG[]).
residual - The visualized data from Analyser.visualize(vec_math.VectorG[], vec_math.VectorG[]).
Returns:
A significance, 1-false-Alarm probability