Package jsl.utilities.statistic.welch
Class WelchDataArrayCollector
- java.lang.Object
-
- jsl.utilities.statistic.welch.AbstractWelchDataCollector
-
- jsl.utilities.statistic.welch.WelchDataArrayCollector
-
- All Implemented Interfaces:
WelchDataCollectorIfc
public class WelchDataArrayCollector extends AbstractWelchDataCollector
-
-
Field Summary
-
Fields inherited from class jsl.utilities.statistic.welch.AbstractWelchDataCollector
myAveragesForReps, myAvgTBOForReps, myBatchSize, myLastTime, myLastValue, myName, myObsCount, myObsCountsForReps, myRepStat, myStatType, myTBOStats, myTimeOfLastObsForReps, myWithinRepStats
-
-
Constructor Summary
Constructors Constructor Description WelchDataArrayCollector(int maxNumObs, int maxNumReps, StatisticType statisticType, java.lang.String name, double batchSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginReplication()
Should be executed prior to each replicationvoid
cleanUpCollector()
Should be executed once after all replications have been observedvoid
clearData()
Sets all the data to Double.NaNvoid
collect(double time, double value)
void
endReplication()
Should be executed after each replicationdouble[][]
getData()
Columns are the replications, rows are the dataint
getMinNumberOfRowsAcrossReplications()
If no replications have been completed this returns 0double[]
getReplicationData(int repNum)
double[]
getWelchAverages()
Welch average is across each replication for each observationdouble[]
getWelchCumulativeAverages()
Gets an array that contains the cumulative average over the Welch Averagesvoid
setUpCollector()
Should be executed once prior to any collection and should be used to clear any statistical collection and prepare the collector for collecting data.void
writeCSVWelchData(java.io.PrintWriter out)
Writes out the number of observations to the supplied PrintWriter This results in a comma separated value file that has each rows containing each observation for each replication and each replication as columns.void
writeCSVWelchPlotData(java.io.PrintWriter out)
Writes out all of the observations to the supplied PrintWriter This results in a comma separated value file that has two columns: Avg, CumAvg containing each Welch plot data point for all of the observations.-
Methods inherited from class jsl.utilities.statistic.welch.AbstractWelchDataCollector
getAvgTimeBtwObservationsForEachReplication, getBatchSize, getLastTime, getLastValue, getNumberOfObservationsForEachReplication, getNumberOfReplications, getReplicationAverages, getTimeOfLastObservationForReps
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsl.utilities.statistic.welch.WelchDataCollectorIfc
getMinNumberOfObservationsAcrossReplications
-
-
-
-
Constructor Detail
-
WelchDataArrayCollector
public WelchDataArrayCollector(int maxNumObs, int maxNumReps, StatisticType statisticType, java.lang.String name, double batchSize)
-
-
Method Detail
-
clearData
public final void clearData()
Sets all the data to Double.NaN
-
getWelchAverages
public final double[] getWelchAverages()
Welch average is across each replication for each observation- Returns:
- an array of the Welch averages
-
getWelchCumulativeAverages
public final double[] getWelchCumulativeAverages()
Gets an array that contains the cumulative average over the Welch Averages- Returns:
- returns an array that contains the cumulative average
-
getData
public final double[][] getData()
Columns are the replications, rows are the data- Returns:
- a copy of the data
-
getReplicationData
public final double[] getReplicationData(int repNum)
- Parameters:
repNum
- the replication number 1, 2, etc- Returns:
- the within replication data for the indicated replication
-
getMinNumberOfRowsAcrossReplications
public final int getMinNumberOfRowsAcrossReplications()
If no replications have been completed this returns 0- Returns:
- the minimum number of observations (rows) across all the collected replications
-
writeCSVWelchData
public final void writeCSVWelchData(java.io.PrintWriter out)
Writes out the number of observations to the supplied PrintWriter This results in a comma separated value file that has each rows containing each observation for each replication and each replication as columns. The last two columns are avg is the average across the replications and cumAvg. The file is flushed and closed. The header row is: Rep1, Rep2, ..., RepN, Avg, CumAvg- Parameters:
out
- the PrintWriter
-
writeCSVWelchPlotData
public final void writeCSVWelchPlotData(java.io.PrintWriter out)
Writes out all of the observations to the supplied PrintWriter This results in a comma separated value file that has two columns: Avg, CumAvg containing each Welch plot data point for all of the observations. The file is flushed and closed.- Parameters:
out
- the PrintWriter
-
setUpCollector
public void setUpCollector()
Description copied from interface:WelchDataCollectorIfc
Should be executed once prior to any collection and should be used to clear any statistical collection and prepare the collector for collecting data.- Specified by:
setUpCollector
in interfaceWelchDataCollectorIfc
- Overrides:
setUpCollector
in classAbstractWelchDataCollector
-
beginReplication
public void beginReplication()
Description copied from interface:WelchDataCollectorIfc
Should be executed prior to each replication- Specified by:
beginReplication
in interfaceWelchDataCollectorIfc
- Overrides:
beginReplication
in classAbstractWelchDataCollector
-
collect
public void collect(double time, double value)
- Parameters:
time
- the time that the observation occurredvalue
- the value of the observation at the observed time
-
endReplication
public void endReplication()
Description copied from interface:WelchDataCollectorIfc
Should be executed after each replication- Specified by:
endReplication
in interfaceWelchDataCollectorIfc
- Overrides:
endReplication
in classAbstractWelchDataCollector
-
cleanUpCollector
public void cleanUpCollector()
Description copied from interface:WelchDataCollectorIfc
Should be executed once after all replications have been observed
-
-