Package org.scictrl.csshell.math
Class Smoothing
java.lang.Object
org.scictrl.csshell.math.Smoothing
Smoothing out measurement curve.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
avg
(double[] data, int start, int count) Averages elements in sub-array for given data arraystatic final double[][]
collapseSame
(double[] x, double[] y) Collapses measurement data points where for same x value there is several y values by calculating average and collapse measurement to a single x, y(avg) point.static final double[]
smoothAvg
(double[] data, int sample) Runs average over data, producing new average point for each sample count of data points.static double
sum
(double[] data, int start, int count) Sums elements sub-array for give data array
-
Method Details
-
sum
public static double sum(double[] data, int start, int count) Sums elements sub-array for give data array- Parameters:
data
- the data arraystart
- start index of sub-arraycount
- the count of elements in sub-array- Returns:
- sum of elements of sub-array
-
avg
public static double avg(double[] data, int start, int count) Averages elements in sub-array for given data array- Parameters:
data
- the data arraystart
- start index of sub-arraycount
- the count of elements in sub-array- Returns:
- average of elements of sub-array
-
smoothAvg
public static final double[] smoothAvg(double[] data, int sample) Runs average over data, producing new average point for each sample count of data points. Averaged data points is in the center of sub-array of Averages at start and end of data array are made with less samples due to sample region reaches over array dimension.- Parameters:
data
- the data arraysample
- number of samples over which average is calculate for data points- Returns:
- array with averaged points
-
collapseSame
public static final double[][] collapseSame(double[] x, double[] y) Collapses measurement data points where for same x value there is several y values by calculating average and collapse measurement to a single x, y(avg) point.- Parameters:
x
- measurement on x sidey
- corresponding measurement on y side- Returns:
- combined two arrays [collapsed x array][averaged y array]
-