vec_math
Class SmoothParabola

java.lang.Object
  extended by vec_math.SmoothParabola

public class SmoothParabola
extends Object

This class searches a smoothened maximum/minimum for a tabulated function, whose extremum can be fitted quite well with a parabola. The procedure is as follows:


Constructor Summary
SmoothParabola()
           
 
Method Summary
private static int extremum(VectorG[] data, int index, double sign, int from, int to)
          Searches an extremum.
static List<Extremum> findExtrema(VectorG[] data, int index)
          Scans the entire array for all local minima and maxima, which are returned as a list of Extremums.
static int maximum(VectorG[] data, int index)
          Searches a global maximum.
static int maximum(VectorG[] data, int index, int from, int to)
          Searches a global maximum.
static int minimum(VectorG[] data, int index)
          Searches a global minimum.
static int minimum(VectorG[] data, int index, int from, int to)
          Searches a global minimum.
private static int slide(VectorG[] data, int index, int at, double sign)
          Slides up/down from a given index, until an extremum is reached and returns the index in the array.
static int slideDown(VectorG[] data, int index, int around)
          Slides from the given index down and returns the minimum index there.
static int slideUp(VectorG[] data, int index, int around)
          Slides from the given index up and returns the maximum index there.
static Vector3D smoothExtremum(VectorG[] data, int steps, int xindex, int yindex, int extremum)
          We returned a smoothend parabel value by the following way: Around the extremal index (see maximum(vec_math.VectorG[], int) etc), we take the values +1/-1, if permitted by the array size or two pixel to the left/right of index. We fit a parabel through these points and record x and y of the extremum. For step trials, we add points from the left/right of the current active points, whoever is closer to the extremal value (array size permitting). For each set of trial points, we fit a regression parabola and record x and y of the extremum, as well as fwhm^2. We return the median x, y and fwhm^2 of all parabolas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmoothParabola

public SmoothParabola()
Method Detail

maximum

public static int maximum(VectorG[] data,
                          int index)
Searches a global maximum. The index of the array at the maximum is returned. From the input data, only the coordinate searched for is used.

Parameters:
data - Each Vector contains the functional value at index i.
index - The coordinate index of the vector to search.
Returns:
The index in the array whose vector has the extremum.

maximum

public static int maximum(VectorG[] data,
                          int index,
                          int from,
                          int to)
Searches a global maximum. The index of the array at the maximum is returned. From the input data, only the coordinate searched for is used.

Parameters:
data - Each Vector contains the functional value at index i.
index - The coordinate index of the vector to search.
Returns:
The index in the array whose vector has the extremum.

minimum

public static int minimum(VectorG[] data,
                          int index)
Searches a global minimum. The index of the array at the maximum is returned. From the input data, only the coordinate searched for is used.

Parameters:
data - Each Vector contains the functional value at index i.
index - The coordinate index of the vector to search.
Returns:
The index in the array whose vector has the extremum.

minimum

public static int minimum(VectorG[] data,
                          int index,
                          int from,
                          int to)
Searches a global minimum. The index of the array at the maximum is returned. From the input data, only the coordinate searched for is used.

Parameters:
data - Each Vector contains the functional value at index i.
index - The coordinate index of the vector to search.
Returns:
The index in the array whose vector has the extremum.

slideUp

public static int slideUp(VectorG[] data,
                          int index,
                          int around)
Slides from the given index up and returns the maximum index there.


slideDown

public static int slideDown(VectorG[] data,
                            int index,
                            int around)
Slides from the given index down and returns the minimum index there.


slide

private static int slide(VectorG[] data,
                         int index,
                         int at,
                         double sign)
Slides up/down from a given index, until an extremum is reached and returns the index in the array.


findExtrema

public static List<Extremum> findExtrema(VectorG[] data,
                                         int index)
Scans the entire array for all local minima and maxima, which are returned as a list of Extremums. This list can be sorted, which then returns the highest maximum at list end, the lowest minimum at index zero. Note that the end and the beginning of the array (index 0 and len-1) are always in the returned list, though they might fail the picture of an extremum framed by higher (lower) values.

Parameters:
index - the index in the vector to search.
Returns:
null if input is null, a single minimum if only one entry, otherwise all local maxima and minima, including start and end of array.

extremum

private static int extremum(VectorG[] data,
                            int index,
                            double sign,
                            int from,
                            int to)
Searches an extremum.


smoothExtremum

public static Vector3D smoothExtremum(VectorG[] data,
                                      int steps,
                                      int xindex,
                                      int yindex,
                                      int extremum)
We returned a smoothend parabel value by the following way:

Parameters:
data - The x and y data.
steps - The number of steps for smoothing, 0=direct solution
xindex - The index in a vector that holds the independent variable.
yindex - The index in a vector that holds the dependent variable.
extremum - The index in the array with the extremal vector