vec_math
Class MultipleFrequencyFit

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

public class MultipleFrequencyFit
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 the given order number to the data the Fourier frequencies are estimated from the highest frequency from a CleanFourier periodogram on the residual data.


Nested Class Summary
static class MultipleFrequencyFit.File
          Use the fourier least-squares on file data.
(package private)  class MultipleFrequencyFit.FourierComponents
           
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  List<Vector1D> alarms
          The false alarm probabilities of the solutions.
static double DEFCONVERGENCE
          Default rms convergence criterium.
static double DEFFALSEALARM
          Default rms convergence criterium.
private static boolean DEFUSESIMPLEX
          Default use fast-convergent levenberg-marquardt.
private static boolean DEFVISUALIZEALL
          Default visualize all
static String KEY_CONVERGENCE
          If frequency is stable to this number, series stop.
static String KEY_FALSEALARM
          The key for the maximum Fourier series order, no default
static String KEY_KEEPFIXED
          On reiterations, these terms are kept fix.
static String KEY_MAXFREQ
          If given, a maximum frequency to scan.
static String KEY_MINFREQ
          If given, a minimum frequency to scan.
static String KEY_ORDER
          The key for the maximum Fourier series order, no default
static String KEY_REITERATE
          If true, the final solution is re-iterated if -p.
static String KEY_USESIMPLEX
          On reiterations use the more robust simplex on improving.
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.
private  double xav
          Intermittance storage for second-step improvement.
private  double yav
          Intermittance storage for second-step improvement.
 
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
MultipleFrequencyFit(Map<String,String> prop)
          Creates a new phase dispersion minimizer.
 
Method Summary
 long[] functionCalls(VectorG[] in)
          No estimate possible.
private  VectorG improve(VectorG[] in, List<VectorG> freqs, int[] fixorder)
          Improvement of multidimensional fourier fit means we take a vector of frequencies and amplitudes, construct single-order fourier series out of them and let all frequencies and amplitudes varry, except those stated in the fixed orders array.
 Object[] metadata(VectorG[] in, VectorG[] allfits, VectorG[] p)
          Metadata are the fitting Fouries with their false alarm probabilities.
 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_ORDER

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

See Also:
Constant Field Values

KEY_FALSEALARM

public static final String KEY_FALSEALARM
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

KEY_MINFREQ

public static final String KEY_MINFREQ
If given, a minimum frequency to scan.

See Also:
Constant Field Values

KEY_MAXFREQ

public static final String KEY_MAXFREQ
If given, a maximum frequency to scan.

See Also:
Constant Field Values

KEY_REITERATE

public static final String KEY_REITERATE
If true, the final solution is re-iterated if -p.

See Also:
Constant Field Values

KEY_KEEPFIXED

public static final String KEY_KEEPFIXED
On reiterations, these terms are kept fix.

See Also:
Constant Field Values

KEY_USESIMPLEX

public static final String KEY_USESIMPLEX
On reiterations use the more robust simplex on improving.

See Also:
Constant Field Values

DEFCONVERGENCE

public static final double DEFCONVERGENCE
Default rms convergence criterium.

See Also:
Constant Field Values

DEFFALSEALARM

public static final double DEFFALSEALARM
Default rms convergence criterium.

See Also:
Constant Field Values

DEFVISUALIZEALL

private static final boolean DEFVISUALIZEALL
Default visualize all

See Also:
Constant Field Values

DEFUSESIMPLEX

private static final boolean DEFUSESIMPLEX
Default use fast-convergent levenberg-marquardt.

See Also:
Constant Field Values

valid

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


alarms

private List<Vector1D> alarms
The false alarm probabilities of the solutions.


xav

private double xav
Intermittance storage for second-step improvement.


yav

private double yav
Intermittance storage for second-step improvement.

Constructor Detail

MultipleFrequencyFit

public MultipleFrequencyFit(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.

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. If KEY_REITERATE is set to true, the highest fit is re-entered to an amoeba, where all parameters, except those for order fixed by the comma-separated string in KEY_KEEPFIXED are allowed to change again.

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.

functionCalls

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

Returns:
null If unknown.

metadata

public Object[] metadata(VectorG[] in,
                         VectorG[] allfits,
                         VectorG[] p)
Metadata are the fitting Fouries with their false alarm probabilities.

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

improve

private VectorG improve(VectorG[] in,
                        List<VectorG> freqs,
                        int[] fixorder)
Improvement of multidimensional fourier fit means we take a vector of frequencies and amplitudes, construct single-order fourier series out of them and let all frequencies and amplitudes varry, except those stated in the fixed orders array. This array is sorted.