Package Localiser.algorithms
Class PeakSearch
java.lang.Object
Localiser.algorithms.PeakSearch
Peak search algorithms which can find a peak in an array of real numbers.
Used by various localisers to find the best peak in correlation data.
Contains a number of options for interpolating in both x and y to find the best peak position. All functions return a PeakData object which contains the peak position and it's height.
- Author:
- Doug Gillespie
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
interpolatedPeakSearch
(double[] data) find the height and position of the peak in a range or data, starting from binFrom and searching up to and including binTo-1interpolatedPeakSearch
(double[][] data) Interpolated peak search in two dimensions.interpolatedPeakSearch
(double[][] data, int binFrom0, int binTo0, int binFrom1, int binTo1) Interpolated peak search in two dimensions.interpolatedPeakSearch
(double[] data, int binFrom, int binTo) find the height and position of the peak in a range or data, starting from binFrom and searching up to and including binTo-1boolean
boolean
When interpolating, allow dim0 to wrap (useful for circular angles)boolean
When interpolating, allow dim1 to wrap (useful for circular angles)double
parabolicHeight
(double x, double y1, double y2, double y3) Calculate a parabolic maximum height based on three bin heightsvoid
setInterpolateY
(boolean interpolateY) void
setWrapDim0
(boolean wrapDim0) When interpolating, allow dim0 to wrap (useful for circular angles)void
setWrapDim1
(boolean wrapDim1) When interpolating, allow dim1 to wrap (useful for circular angles)void
setWrapStep0
(int wrapStep0) void
setWrapStep1
(int wrapStep1) simplePeakSearch
(double[] data) Find the highest bin, no interpolation or anything.simplePeakSearch
(double[][] data) Simple peak search in two dimensions.simplePeakSearch
(double[][] data, int binFrom0, int binTo0, int binFrom1, int binTo1) Simple peak search in two dimensions.simplePeakSearch
(double[] data, int binFrom, int binTo) find the height and position of the peak in a range or data, starting from binFrom and searching up to and including binTo-1
-
Constructor Details
-
PeakSearch
public PeakSearch(boolean interpolateY) Construct peak search algorithms.- Parameters:
interpolateY
- interpolate the Y coordinate (only when also interpolating x)
-
-
Method Details
-
simplePeakSearch
Find the highest bin, no interpolation or anything.- Parameters:
data
-- Returns:
-
simplePeakSearch
find the height and position of the peak in a range or data, starting from binFrom and searching up to and including binTo-1- Parameters:
data
-binFrom
- first bin to searchbinTo
- last bin + 1- Returns:
- peak position (bin and height)
-
simplePeakSearch
Simple peak search in two dimensions.- Parameters:
data
- 2D array- Returns:
- Peak row, col and height.
-
simplePeakSearch
public PeakPosition2D simplePeakSearch(double[][] data, int binFrom0, int binTo0, int binFrom1, int binTo1) Simple peak search in two dimensions.- Parameters:
data
- 2D arraybinFrom0
- start search bin in first dimensionbinTo0
- end search bin in first dimensionbinFrom1
- start search bin in second dimensionbinTo1
- end search bin in second dimension- Returns:
- Peak row, col and height.
-
interpolatedPeakSearch
find the height and position of the peak in a range or data, starting from binFrom and searching up to and including binTo-1Uses parabolic interpolation to get a more accurate value
- Parameters:
data
-- Returns:
- peak position
-
interpolatedPeakSearch
find the height and position of the peak in a range or data, starting from binFrom and searching up to and including binTo-1Uses parabolic interpolation to get a more accurate value
- Parameters:
data
-binFrom
- first bin to searchbinTo
- last bin + 1- Returns:
- peak position (bin and height)
-
interpolatedPeakSearch
Interpolated peak search in two dimensions.- Parameters:
data
- 2D array- Returns:
- Peak row, col and height.
-
interpolatedPeakSearch
public PeakPosition2D interpolatedPeakSearch(double[][] data, int binFrom0, int binTo0, int binFrom1, int binTo1) Interpolated peak search in two dimensions.- Parameters:
data
- 2D arraybinFrom0
- start search bin in first dimensionbinTo0
- end search bin in first dimensionbinFrom1
- start search bin in second dimensionbinTo1
- end search bin in second dimension- Returns:
- Peak row, col and height.
-
parabolicHeight
public double parabolicHeight(double x, double y1, double y2, double y3) Calculate a parabolic maximum height based on three bin heights- Parameters:
x
- X offset from y2.y1
- first biny2
- second biny3
- third bin- Returns:
- height of parabola through those points.
-
isInterpolateY
public boolean isInterpolateY()- Returns:
- the interpolateY
-
setInterpolateY
public void setInterpolateY(boolean interpolateY) - Parameters:
interpolateY
- the interpolateY to set
-
isWrapDim0
public boolean isWrapDim0()When interpolating, allow dim0 to wrap (useful for circular angles)- Returns:
- the wrapDim0
-
setWrapDim0
public void setWrapDim0(boolean wrapDim0) When interpolating, allow dim0 to wrap (useful for circular angles)- Parameters:
wrapDim0
- the wrapDim0 to set
-
isWrapDim1
public boolean isWrapDim1()When interpolating, allow dim1 to wrap (useful for circular angles)- Returns:
- the wrapDim1
-
setWrapDim1
public void setWrapDim1(boolean wrapDim1) When interpolating, allow dim1 to wrap (useful for circular angles)- Parameters:
wrapDim1
- the wrapDim1 to set
-
getWrapStep0
public int getWrapStep0()- Returns:
- the wrapStep0
-
setWrapStep0
public void setWrapStep0(int wrapStep0) - Parameters:
wrapStep0
- the wrapStep0 to set
-
getWrapStep1
public int getWrapStep1()- Returns:
- the wrapStep1
-
setWrapStep1
public void setWrapStep1(int wrapStep1) - Parameters:
wrapStep1
- the wrapStep1 to set
-