vec_math
Class CleanFourier

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

public class CleanFourier
extends Fourier

A java implementation of the clean algorithm described by Roberts et al. AJ 93, 968 (1987)


Nested Class Summary
static class CleanFourier.Duty
          First test class that does Figure 8f, p 981.
static class CleanFourier.Fig10
          First test class that does Figure 1, p 971.
static class CleanFourier.Fig3
          First test class that does Figure 1, p 971.
static class CleanFourier.File
          File data parser.
 
Nested classes/interfaces inherited from class vec_math.Fourier
Fourier.AbstractFile, Fourier.Series
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static double DEFAMPLITUDE
          Default minimum amplitude.
static double DEFGAIN
          Default gain.
static int DEFITER
          Default maximum iteration number.
static double DEFNYQUIST
          Default nyquist factor to get to maximum frequency.
static double DEFOVERSAMPLING
          Default oversampling.
static double DEFPEAK
          Default minimum subtractable peak-height.
static double DEFSPAN
          Default factor for minimum frequency.
static String KEY_AMPLITUDE
          The key for the minimum amplitude.
static String KEY_FREQMAX
          The key for the maximum frequency to scan, no default.
static String KEY_GAIN
          The key for the gain multiplier.
static String KEY_ITER
          The key for the number of maximum iterations.
static String KEY_NYQUIST
          The key for the nyquist multiplier.
static String KEY_OVERSAMPLING
          The key for the oversampling.
static String KEY_PEAK
          The key for the minimum peak height.
static String KEY_SPAN
          The key for the span multiplier.
static String KEY_STRETCH
          The key for the data time span, no default.
 
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
CleanFourier(Map<String,String> prop)
          Contructs a new lomb periodogram, defaulting the span, the oversampling, and the Nyquist multiplier.
 
Method Summary
private static double[] beam(VectorG[] dft)
          Fits a clean beam to the window function by fitting a real Gaussian with beam(0)=1 to the window.
private static Vector2D[] clean(VectorG[] dirty, double gain, int nmax, double resmax, double cmin)
          Calculates the cleaned DFT of the dirty DFT recursively.
private static VectorG[] dirty(VectorG[] data, double stretch, double fmax, double over)
          Calculates the discrete FT of the data and of the window.
protected  Vector3D[] fourierTransform(VectorG[] data)
          The fourier is done with clean periodogram.
 long[] functionCalls(VectorG[] data)
          We call sin/cos and exp.
static Vector3D[] getClean(VectorG[] data)
          Returns a cleaned spectrum.
static Vector3D[] getClean(VectorG[] data, double stretch, double fmax, double over)
          Returns a cleaned spectrum.
static Vector3D[] getClean(VectorG[] data, double stretch, double fmax, double over, double gain, int nmax, double rmax, double cmin)
          Returns a cleaned spectrum.
static Vector2D[] getPeriodogram(VectorG[] data)
          Returns a periodogram.
static Vector2D[] getPeriodogram(VectorG[] data, double stretch, double fmax, double over)
          Returns a periodogram.
static Vector2D[] getPeriodogram(VectorG[] data, double stretch, double fmax, double over, double gain, int nmax, double rmax, double cmin)
          Returns a periodogram.
private static Vector3D[] pure(VectorG[] residual, Vector2D[] clear, double[] beam)
          Reconstruct the clean spectrum by convolving the clean component with a beam function and add the last dirty DFT of the data, which is the residual after clean(vec_math.VectorG[], double, int, double, double).
 void reset()
          Cleans frequency ans stretch keys.
 
Methods inherited from class vec_math.Fourier
falseAlarm, getMaximumSpan, getMinimumStep, getWhitened, maximum, maximum, maximum, metadata, periodogram, process, significance, visualize
 
Methods inherited from class vec_math.AbstractAnalyser
getBootstrapData, getBootstrapData, getDiminishedData, getDiminishedData, getSyntheticData, getSyntheticData, 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_OVERSAMPLING

public static final String KEY_OVERSAMPLING
The key for the oversampling.

See Also:
Constant Field Values

KEY_NYQUIST

public static final String KEY_NYQUIST
The key for the nyquist multiplier.

See Also:
Constant Field Values

KEY_SPAN

public static final String KEY_SPAN
The key for the span multiplier.

See Also:
Constant Field Values

KEY_GAIN

public static final String KEY_GAIN
The key for the gain multiplier.

See Also:
Constant Field Values

KEY_ITER

public static final String KEY_ITER
The key for the number of maximum iterations.

See Also:
Constant Field Values

KEY_PEAK

public static final String KEY_PEAK
The key for the minimum peak height.

See Also:
Constant Field Values

KEY_AMPLITUDE

public static final String KEY_AMPLITUDE
The key for the minimum amplitude.

See Also:
Constant Field Values

KEY_FREQMAX

public static final String KEY_FREQMAX
The key for the maximum frequency to scan, no default.

See Also:
Constant Field Values

KEY_STRETCH

public static final String KEY_STRETCH
The key for the data time span, no default.

See Also:
Constant Field Values

DEFOVERSAMPLING

public static final double DEFOVERSAMPLING
Default oversampling.

See Also:
Constant Field Values

DEFNYQUIST

public static final double DEFNYQUIST
Default nyquist factor to get to maximum frequency.

See Also:
Constant Field Values

DEFSPAN

public static final double DEFSPAN
Default factor for minimum frequency.

See Also:
Constant Field Values

DEFGAIN

public static final double DEFGAIN
Default gain.

See Also:
Constant Field Values

DEFITER

public static final int DEFITER
Default maximum iteration number.

See Also:
Constant Field Values

DEFPEAK

public static final double DEFPEAK
Default minimum subtractable peak-height.

See Also:
Constant Field Values

DEFAMPLITUDE

public static final double DEFAMPLITUDE
Default minimum amplitude.

See Also:
Constant Field Values
Constructor Detail

CleanFourier

public CleanFourier(Map<String,String> prop)
Contructs a new lomb periodogram, defaulting the span, the oversampling, and the Nyquist multiplier.

Method Detail

reset

public void reset()
Cleans frequency ans stretch keys.

Specified by:
reset in interface Analyser
Overrides:
reset in class AbstractAnalyser

fourierTransform

protected Vector3D[] fourierTransform(VectorG[] data)
The fourier is done with clean periodogram.

Specified by:
fourierTransform in class Fourier
Parameters:
data - The measures, t in x.
Returns:
The fourier transform, x is frequency, y/z is the complex D.

functionCalls

public long[] functionCalls(VectorG[] data)
We call sin/cos and exp.

Returns:
null If unknown.

getPeriodogram

public static final Vector2D[] getPeriodogram(VectorG[] data)
Returns a periodogram.


getPeriodogram

public static final Vector2D[] getPeriodogram(VectorG[] data,
                                              double stretch,
                                              double fmax,
                                              double over)
Returns a periodogram.


getPeriodogram

public static final Vector2D[] getPeriodogram(VectorG[] data,
                                              double stretch,
                                              double fmax,
                                              double over,
                                              double gain,
                                              int nmax,
                                              double rmax,
                                              double cmin)
Returns a periodogram.


getClean

public static final Vector3D[] getClean(VectorG[] data)
Returns a cleaned spectrum.


getClean

public static final Vector3D[] getClean(VectorG[] data,
                                        double stretch,
                                        double fmax,
                                        double over)
Returns a cleaned spectrum.


getClean

public static final Vector3D[] getClean(VectorG[] data,
                                        double stretch,
                                        double fmax,
                                        double over,
                                        double gain,
                                        int nmax,
                                        double rmax,
                                        double cmin)
Returns a cleaned spectrum.


pure

private static final Vector3D[] pure(VectorG[] residual,
                                     Vector2D[] clear,
                                     double[] beam)
Reconstruct the clean spectrum by convolving the clean component with a beam function and add the last dirty DFT of the data, which is the residual after clean(vec_math.VectorG[], double, int, double, double). Appendix C, p 989, (5)

Returns:
A Vector array that has the frequency in x, and real/im part.

beam

private static double[] beam(VectorG[] dft)
Fits a clean beam to the window function by fitting a real Gaussian with beam(0)=1 to the window. A real function suffices, time average was subtracted.


clean

private static final Vector2D[] clean(VectorG[] dirty,
                                      double gain,
                                      int nmax,
                                      double resmax,
                                      double cmin)
Calculates the cleaned DFT of the dirty DFT recursively. On return, the dirty array will contain the residual dft in indices 1 and 2. The user supplies a gain, that should be less than 1 and is the amount of removal of the component from the dirty one. Lower values of gain mean higher number of loops, but are in general more stable. The user can supply different iteration criteria, but at least nmax should be set. The vector returned carries only the real and imaginary components of the clean part of the FT, the residuals will be kept in the DFT part of dirty. Appendix C, p 989, 1-4

Parameters:
nmax - Maximum number of iterations.
resmax - Exit, if highest peak in the residual map is lower
cmin - Exit, if the clean component found is lower.
Returns:
The real/imaginary part of the clean FT, no frequency.

dirty

private static final VectorG[] dirty(VectorG[] data,
                                     double stretch,
                                     double fmax,
                                     double over)
Calculates the discrete FT of the data and of the window. The data must be real, with times in x and values in y. Stretch is normally the entire time span of the data set. The maximum frequency is the inverse of the smallest time-step available, while oversampling is an additional factor that splits this frequency further. A higher value of oversampling allows easier peak-definition (i.e. there will be an index that is close to a true peak).
The data is shifted such that the average of the time and data is subtracted, which allows the use of a purely real beam in the reconstruction. Ref. to Appendix B, p. 988 in the main paper.

What is calculated is the discreate fourier transform of the data plus the window transform. The returned vector has five dimensions, in the first carrying the frequency, at indici 1 and 2 the real/imaginary part of the FT of the data, at indici 3 and 4 the real/imaginary part of the FT of the window. Note that the data only span to half of the size of the returned vector array.

Returns: