Package mgui.neuro.stats
Class SignalProcessing
java.lang.Object
mgui.interfaces.Utility
mgui.neuro.stats.SignalProcessing
public class SignalProcessing extends Utility
Utility class for signal processing functions.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Constructor Summary
Constructors Constructor Description SignalProcessing()
-
Method Summary
Modifier and Type Method Description static java.util.ArrayList<java.lang.Double>
getDerivative(java.util.ArrayList<java.lang.Double> curve, int order)
Returns a set of data points which represent theorder
th order derivative ofcurve
.static java.util.ArrayList<java.lang.Double>
getNormalizedCurve(java.util.ArrayList<java.lang.Double> curve)
Normalizes this curve to the max and min of its values.static java.util.ArrayList<java.lang.Double>
getNormalizedCurve(java.util.ArrayList<java.lang.Double> curve, double min, double max)
Normalizes this curve to max and min.static java.util.ArrayList<java.lang.Double>
getResampledCurve(java.util.ArrayList<java.lang.Double> curve, int samples, int order)
Resample (interpolate with order) curve to specified number of samples.static java.util.ArrayList<java.lang.Double>
smoothCurveMovingAverage(java.util.ArrayList<java.lang.Double> curve, int n)
Smoothscurve
using a moving-average algorithm, with a window widthn
= 2m + 1; where n is an odd number.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
SignalProcessing
public SignalProcessing()
-
-
Method Details
-
smoothCurveMovingAverage
public static java.util.ArrayList<java.lang.Double> smoothCurveMovingAverage(java.util.ArrayList<java.lang.Double> curve, int n)Smoothscurve
using a moving-average algorithm, with a window widthn
= 2m + 1; where n is an odd number. Each data point is assigned a value according to the function:y(k)_s = SUM[i = -m : m](y_k+1) / n
See http://www.chem.uoa.gr/applets/appletsmooth/appl_smooth2.html
- Parameters:
curve
-n
-- Returns:
-
getDerivative
public static java.util.ArrayList<java.lang.Double> getDerivative(java.util.ArrayList<java.lang.Double> curve, int order)Returns a set of data points which represent theorder
th order derivative ofcurve
. The result will haveorder
less elements thancurve
.- Parameters:
curve
- the curve for which to compute the derivativeorder
- the order of the derivative to compute- Returns:
- the derivative for
curve
, with n - 1 elements
-
getResampledCurve
public static java.util.ArrayList<java.lang.Double> getResampledCurve(java.util.ArrayList<java.lang.Double> curve, int samples, int order)Resample (interpolate with order) curve to specified number of samples. Currently only resamples with linear interpolation.- Parameters:
curve
- the curve to resamplesamples
- the number of samples in the resulting curvethe
- order of the interpolation (currently does nothing as only linear interpolation is implemented.- Returns:
- the resampled curve
-
getNormalizedCurve
public static java.util.ArrayList<java.lang.Double> getNormalizedCurve(java.util.ArrayList<java.lang.Double> curve)Normalizes this curve to the max and min of its values.- Parameters:
curve
- the curve to normalizemin
- the minimum for the normalizationmax
- the maximum for the normalization- Returns:
- the normalized curve
-
getNormalizedCurve
public static java.util.ArrayList<java.lang.Double> getNormalizedCurve(java.util.ArrayList<java.lang.Double> curve, double min, double max)Normalizes this curve to max and min.- Parameters:
curve
- the curve to normalizemin
- the minimum for the normalizationmax
- the maximum for the normalization- Returns:
- the normalized curve
-