Package adams.data.threeway
Class L1PointUtils
- java.lang.Object
-
- adams.data.threeway.L1PointUtils
-
public class L1PointUtils extends Object
A helper class for the Level 2 points of a given Level 1 point.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected static L2PointComparator
m_Comparator
the comparator in use.
-
Constructor Summary
Constructors Constructor Description L1PointUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static L1Point
closest(long x, L1Point left, L1Point right)
Returns a level 1 point with the level 2 data of the closest of the two level 1 points.static int
findMassCharge(List<L2Point> points, double x)
Returns the index in points of the given timestamp.static int
findX(List<L2Point> points, L2Point p)
Returns the index in points of the given level 2 point, -1 if not found.static double[]
getHistogram(L1Point l1, int numBins)
Generates data for a histogram display.static L1Point
interpolate(double x, L1Point left, L1Point right)
Interpolates the two level 1 points and the corresponding level 2 data.static L1Point
merge(L1Point point1, L1Point point2)
Merges the two level 1 points.static double[]
toDoubleArray(L1Point c)
Returns the abundance as double array.static double[]
toDoubleArray(List<L2Point> data)
Returns the abundance as double array.
-
-
-
Field Detail
-
m_Comparator
protected static L2PointComparator m_Comparator
the comparator in use.
-
-
Method Detail
-
findX
public static int findX(List<L2Point> points, L2Point p)
Returns the index in points of the given level 2 point, -1 if not found.- Parameters:
points
- the list of level 2 points to search inp
- the point to get the index for- Returns:
- the index or -1 if not found
-
findMassCharge
public static int findMassCharge(List<L2Point> points, double x)
Returns the index in points of the given timestamp.- Parameters:
points
- the list of level points to search inx
- the X to get the index for- Returns:
- the index
-
merge
public static L1Point merge(L1Point point1, L1Point point2)
Merges the two level 1 points. It sums up the Y of each point and also merges the level 2 data (level 2 points with the same X will get summed up as well).- Parameters:
point1
- the first pointpoint2
- the second point- Returns:
- the merged data
-
getHistogram
public static double[] getHistogram(L1Point l1, int numBins)
Generates data for a histogram display. It counts how many level 2 points have the same Y in the level 1 point.- Parameters:
l1
- the level 1 point to generate the histogram fornumBins
- the number of bins to generate- Returns:
- the histogram data
-
toDoubleArray
public static double[] toDoubleArray(L1Point c)
Returns the abundance as double array.- Parameters:
c
- the GC point to turn into a double array- Returns:
- the abundances as double array
-
toDoubleArray
public static double[] toDoubleArray(List<L2Point> data)
Returns the abundance as double array.- Parameters:
data
- the MS points to turn into a double array- Returns:
- the abundances as double array
-
interpolate
public static L1Point interpolate(double x, L1Point left, L1Point right)
Interpolates the two level 1 points and the corresponding level 2 data.- Parameters:
x
- the timestamp we have to interpolate forleft
- the left level 1 pointright
- the right level 1 point- Returns:
- the interpolated level 1 point
-
closest
public static L1Point closest(long x, L1Point left, L1Point right)
Returns a level 1 point with the level 2 data of the closest of the two level 1 points.- Parameters:
x
- the X we have to interpolate forleft
- the left level 1 pointright
- the right level 1 point- Returns:
- the interpolated level 1point
-
-