Package de.gsi.math
Class SimpleDataSetEstimators
- java.lang.Object
-
- de.gsi.math.SimpleDataSetEstimators
-
public final class SimpleDataSetEstimators extends java.lang.Objectcomputation of statistical estimates- Author:
- rstein
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublecomputeCentreOfMass(de.gsi.dataset.DataSet dataSet)Compute centre of mass over full DataSetstatic doublecomputeCentreOfMass(de.gsi.dataset.DataSet dataSet, double min, double max)Computes the centre of mass in a given x range.static doublecomputeCentreOfMass(de.gsi.dataset.DataSet dataSet, int minIndex, int maxIndex)Computes the centre of mass in a given index range.static doublecomputeFWHM(double[] data, int length, int index)compute simple Full-Width-Half-Maximum (no inter-bin interpolation)static doublecomputeInterpolatedFWHM(double[] data, int length, int index)compute interpolated Full-Width-Half-Maximumstatic doublegetDistance(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, boolean isHorizontal)static double[]getDoubleArray(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetDutyCycle(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetEdgeDetect(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)Gets the time from indexMin until the signal reaches 50% of its range.static doublegetFrequencyEstimate(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetFullWidthHalfMaximum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, boolean interpolate)static doublegetIntegral(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static intgetLocationMaximum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetLocationMaximumGaussInterpolated(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetMaximum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetMean(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetMedian(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetMinimum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetRange(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)Returns the range of the y Data of the dataSet between the given indices.static doublegetRms(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetSimpleRiseTime(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetSimpleRiseTime(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, double min, double max)static doublegetSimpleRiseTime1090(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetSimpleRiseTime2080(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)static doublegetTransmission(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, boolean isAbsoluteTransmission)Returns transmission as the absolute or relative ratio between the signal at the indexMin'th sample and the indexMax'th sample.static doublegetZeroCrossing(de.gsi.dataset.DataSet dataSet, double threshold)static doubleinterpolateGaussian(double[] data, int length, int index)interpolation using a Gaussian interpolationstatic doublelinearInterpolate(double x0, double x1, double y0, double y1, double y)protected static doublerootMeanSquare(double[] data, int length)protected static double[]sort(double[] a, int length, boolean down)Sorts the input a array
-
-
-
Method Detail
-
computeCentreOfMass
public static double computeCentreOfMass(de.gsi.dataset.DataSet dataSet)
Compute centre of mass over full DataSet- Parameters:
dataSet- input dataset- Returns:
- centre of mass
-
computeCentreOfMass
public static double computeCentreOfMass(de.gsi.dataset.DataSet dataSet, double min, double max)Computes the centre of mass in a given x range.- Parameters:
dataSet- input datasetmin- min indexmax- max index- Returns:
- centre of mass
-
computeCentreOfMass
public static double computeCentreOfMass(de.gsi.dataset.DataSet dataSet, int minIndex, int maxIndex)Computes the centre of mass in a given index range.- Parameters:
dataSet- input datasetminIndex- min indexmaxIndex- max index- Returns:
- centre of mass
-
computeFWHM
public static double computeFWHM(double[] data, int length, int index)compute simple Full-Width-Half-Maximum (no inter-bin interpolation)- Parameters:
data- data arraylength- of data arrayindex- 0< index < data.length- Returns:
- FWHM estimate [bins]
-
computeInterpolatedFWHM
public static double computeInterpolatedFWHM(double[] data, int length, int index)compute interpolated Full-Width-Half-Maximum- Parameters:
data- data arraylength- of data arrayindex- 0< index < data.length- Returns:
- FWHM estimate [bins]
-
getDistance
public static double getDistance(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, boolean isHorizontal)
-
getDoubleArray
public static double[] getDoubleArray(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getDutyCycle
public static double getDutyCycle(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getEdgeDetect
public static double getEdgeDetect(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)Gets the time from indexMin until the signal reaches 50% of its range. If y(indexMax) > y(indexMin) rising edge is detected, otherwise falling edge. If the range is not finite or zero, returns NaN.- Parameters:
dataSet- DataSetindexMin- first index to look at (inclusive)indexMax- last index to look at (exclusive)- Returns:
- time from indexMin to 50% of data range reached
-
getFrequencyEstimate
public static double getFrequencyEstimate(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getFullWidthHalfMaximum
public static double getFullWidthHalfMaximum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, boolean interpolate)
-
getIntegral
public static double getIntegral(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)- Parameters:
dataSet- input datasetindexMin- the starting indexindexMax- the end index (switching indices reverses sign of result)- Returns:
- the Integral of the DataSet according to the trapezoidal rule
-
getLocationMaximum
public static int getLocationMaximum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getLocationMaximumGaussInterpolated
public static double getLocationMaximumGaussInterpolated(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getMaximum
public static double getMaximum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getMean
public static double getMean(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getMedian
public static double getMedian(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getMinimum
public static double getMinimum(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getRange
public static double getRange(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)Returns the range of the y Data of the dataSet between the given indices. This equals the maximum value in the range minus the minimum value.- Parameters:
dataSet- input datasetindexMin- min indexindexMax- max index- Returns:
- the range of yData between the given indices
-
getRms
public static double getRms(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getSimpleRiseTime
public static double getSimpleRiseTime(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)- Parameters:
dataSet- input datasetindexMin- min indexindexMax- max index- Returns:
- the 20% to 80% rise time of the signal
-
getSimpleRiseTime
public static double getSimpleRiseTime(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, double min, double max)
-
getSimpleRiseTime1090
public static double getSimpleRiseTime1090(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getSimpleRiseTime2080
public static double getSimpleRiseTime2080(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax)
-
getTransmission
public static double getTransmission(de.gsi.dataset.DataSet dataSet, int indexMin, int indexMax, boolean isAbsoluteTransmission)Returns transmission as the absolute or relative ratio between the signal at the indexMin'th sample and the indexMax'th sample. The result is returned in percent.- Parameters:
dataSet- A dataSetindexMin- The index to look at for the initial quantitiyindexMax- The index to look at for the final quantitiyisAbsoluteTransmission- true for absolute transmission, false for relative transmission- Returns:
- The transmission in percent
-
getZeroCrossing
public static double getZeroCrossing(de.gsi.dataset.DataSet dataSet, double threshold)
-
interpolateGaussian
public static double interpolateGaussian(double[] data, int length, int index)interpolation using a Gaussian interpolation- Parameters:
data- data arraylength- length of data arraysindex- 0< index < data.length- Returns:
- location of the to be interpolated peak [bins]
-
linearInterpolate
public static double linearInterpolate(double x0, double x1, double y0, double y1, double y)
-
rootMeanSquare
protected static double rootMeanSquare(double[] data, int length)- Parameters:
data- the input vectorlength- number of elements (less than data.length) to be used- Returns:
- un-biased r.m.s. of vector elements
-
sort
protected static double[] sort(double[] a, int length, boolean down)Sorts the input a array- Parameters:
a- the input arraylength- number of elements (less than data.length) to be useddown- true: ascending , false: descending order- Returns:
- the sorted array
-
-