|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object peakml.math.Signal
public class Signal
Implementation of a approaches for interpreting and analysing signals. In the context of this project a signal is made up of mass spectrometry data or data from closely related technologies.
Nested Class Summary | |
---|---|
class |
Signal.Extremes
|
Constructor Summary | |
---|---|
Signal()
This constructor creates an empty signal (no elements). |
|
Signal(double[] yvals)
This constructor creates a signal out of the given y-values. |
|
Signal(double[] xvals,
double[] yvals)
This constructor creates a signal out of the given x- and y-values. |
|
Signal(int size)
This constructor creates a signal of the given size. |
|
Signal(Signal signal)
Copy-constructor, which copies the contents of the given signal to this signal. |
Method Summary | |
---|---|
double |
compareTo(Signal other)
Compares the given signal to this signal. |
org.jfree.chart.JFreeChart |
createGraph(java.lang.String name,
java.lang.String xlabel,
java.lang.String ylabel)
|
java.awt.image.BufferedImage |
createGraphImage(java.lang.String name,
java.lang.String xlabel,
java.lang.String ylabel,
int width,
int height)
|
Signal.Extremes |
getLocalExtremes(int windowsize)
|
java.util.Vector<java.lang.Double> |
getLocalMaxima(int windowsize)
|
java.util.Vector<java.lang.Double> |
getLocalMinima(int windowsize)
|
double |
getMaxX()
Returns the maximum x-value. |
double |
getMaxY()
Returns the maximum y-value. |
double |
getMeanY()
Returns the mean y-value. |
double |
getMinX()
Returns the minimum x-value. |
double |
getMinY()
Returns the minimum y-value. |
double |
getPeakX()
Returns the x-value where the signal reaches its maximum y-value. |
int |
getSize()
Returns the number of data-points in this signal. |
double[] |
getX()
Returns the internal array with all the x-values. |
double[][] |
getXY()
Returns a matrix with the x- and y-values. |
double[] |
getY()
Returns the internal array with all the y-values. |
double |
getY(double x)
Returns the y-value at the given x-value. |
int |
indexMaxY()
|
void |
Init(int size)
Initializes the signal to the given size. |
Signal |
lowessSmooth()
Applies a Lowess smoother to the signal and returns the resulting new signal. |
void |
normalize()
This function scales the y-values between 0 and 1. |
void |
normalize(double max)
This function scales the y-values between 0 and the given max. |
double[] |
pearsonsCorrelation(Signal other)
Calculates the Pearson's correlation between this and the given signal. |
Signal |
savitzkyGolaySmooth()
Applies a Savitzky-Golay smoother to the signal and returns the resulting new signal. |
Signal |
savitzkyGolaySmooth(SavitzkyGolayFilter.Points points)
Applies a Savitzky-Golay smoother to the signal and returns the resulting new signal. |
Signal |
smooth(Filter filter)
Applies the given filter to the y-values and returns the resulting new signal. |
double |
spearmanCorrelation(Signal other)
Calculates the Spearman correlation between this and the given signal. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Signal()
public Signal(int size)
size
- The size of the signal.public Signal(double[] yvals)
yvals
- The y-values to initialize the signal with.public Signal(double[] xvals, double[] yvals) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
xvals
- The x-values.yvals
- The y-values.
java.lang.NullPointerException
- Thrown when null was passed to one of both of the parameters.
java.lang.IllegalArgumentException
- Thrown when the size of the arrays is not equal.public Signal(Signal signal)
signal
- The signal to copy.Method Detail |
---|
public void Init(int size)
size
- The size to initialize the signal to.public double[] getX()
public double[] getY()
public double getY(double x)
x
- The x-value.
public double[][] getXY()
public int getSize()
public double getMinX()
public double getMinY()
public double getMaxX()
public double getMaxY()
public int indexMaxY()
public double getMeanY()
public double getPeakX()
public void normalize()
getMaxY()
and normalize()
are called.
public void normalize(double max)
max
- The maximum y-value to scale to.public Signal savitzkyGolaySmooth()
SavitzkyGolayFilter.Points#NINE
,
which seems to give overall good results without affecting the signal itself
too much. For more information see SavitzkyGolayFilter
.
public Signal savitzkyGolaySmooth(SavitzkyGolayFilter.Points points)
SavitzkyGolayFilter
.
points
- The number of points to use in the smoother.
public Signal lowessSmooth()
LoessFilter
.
public Signal smooth(Filter filter)
public double compareTo(Signal other)
other
- The signal to compare this signal to.
public double[] pearsonsCorrelation(Signal other)
Statistical.pearsonsCorrelation(double[], double[])
.
Only the correlation is returned, even though the called method also returns
test values.
other
- The signal to compare this signal to.
public double spearmanCorrelation(Signal other)
Statistical.spearmanCorrelation(double[], double[])
.
Only the correlation is returned, even though the called method also returns
test values.
other
- The signal to compare this signal to.
public Signal.Extremes getLocalExtremes(int windowsize)
public java.util.Vector<java.lang.Double> getLocalMinima(int windowsize)
public java.util.Vector<java.lang.Double> getLocalMaxima(int windowsize)
public org.jfree.chart.JFreeChart createGraph(java.lang.String name, java.lang.String xlabel, java.lang.String ylabel)
public java.awt.image.BufferedImage createGraphImage(java.lang.String name, java.lang.String xlabel, java.lang.String ylabel, int width, int height)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |