etomica.data
Class AccumulatorAverage

java.lang.Object
  extended by etomica.data.DataProcessor
      extended by etomica.data.DataProcessorForked
          extended by etomica.data.DataAccumulator
              extended by etomica.data.AccumulatorAverage
All Implemented Interfaces:
DataPipe, DataPipeForked, IDataSink, IDataSource, IEtomicaDataSource, Serializable
Direct Known Subclasses:
AccumulatorAverageCollapsing, AccumulatorAverageFixed, AccumulatorAverageFixedOutputFile

public abstract class AccumulatorAverage
extends DataAccumulator

Accumulator that keeps statistics for averaging and error analysis. The statisics are incremented with every call to addData. Statistics kept are

Each statistic is recorded by a Data instance of the same type as the incoming data. The output Data is a DataGroup formed from these Data instances (in the order given above).

A block is a subset of the input data, formed by grouping (for example) 100 or 1000 successive contributions to addData. Averages for each block are considered to be independent of other block averages, and the confidence limits for the overall average is obtained as the standard error of the mean of these block averages.

See Also:
Serialized Form

Nested Class Summary
static class AccumulatorAverage.StatType
          Enumerated type that can be used to indicated the statistic to be taken from the accumulator (e.g., average, error, current value, etc.).
 
Field Summary
protected  IData average
           
protected  IData blockCorrelation
           
protected  long blockCountDown
           
protected  long blockSize
           
protected  long count
           
protected  DataGroup dataGroup
           
protected  IData error
           
protected  IData mostRecent
           
protected  IData standardDeviation
           
 
Fields inherited from class etomica.data.DataAccumulator
active, putCount
 
Fields inherited from class etomica.data.DataProcessor
dataInfo, dataSink, tag, trueDataSink
 
Constructor Summary
AccumulatorAverage()
          Default constructor sets block size to Default value, and sets the interval for pushing the output data (pushInterval) to 100.
AccumulatorAverage(long blockSize)
           
 
Method Summary
 void addDataSink(IDataSink newDataSink, AccumulatorAverage.StatType[] types)
          Adds a new DataSink that will receive a specific subset of the statistics generated by this accumulator.
 long getBlockCount()
          Returns the number of blocks that have been accumulated since construction or the last call to reset.
 long getBlockSize()
          Returns the current value of the block size.
 DataTag getTag(AccumulatorAverage.StatType statType)
           
 IEtomicaDataInfo processDataInfo(IEtomicaDataInfo incomingDataInfo)
          Prepares the accumulator for input data.
 void reset()
          Resets all sums to zero.
 void setBlockSize(long newBlockSize)
          Sets the size of the block used to group data for error analysis.
 
Methods inherited from class etomica.data.DataAccumulator
addData, getData, getPushInterval, isActive, processData, setActive, setPushInterval, toString
 
Methods inherited from class etomica.data.DataProcessorForked
addDataSink, getDataSink, getDataSinks, removeDataSink, setDataSink, setDataSinks
 
Methods inherited from class etomica.data.DataProcessor
getDataInfo, getTag, insertTransformerIfNeeded, putData, putDataInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface etomica.data.IEtomicaDataSource
getDataInfo, getTag
 
Methods inherited from interface etomica.data.DataPipe
getTag
 
Methods inherited from interface etomica.data.IDataSink
getDataCaster, putData, putDataInfo
 

Field Detail

mostRecent

protected IData mostRecent

average

protected IData average

error

protected IData error

standardDeviation

protected IData standardDeviation

blockCorrelation

protected IData blockCorrelation

dataGroup

protected DataGroup dataGroup

count

protected long count

blockCountDown

protected long blockCountDown

blockSize

protected long blockSize
Constructor Detail

AccumulatorAverage

public AccumulatorAverage()
Default constructor sets block size to Default value, and sets the interval for pushing the output data (pushInterval) to 100.


AccumulatorAverage

public AccumulatorAverage(long blockSize)
Method Detail

getTag

public DataTag getTag(AccumulatorAverage.StatType statType)

reset

public void reset()
Resets all sums to zero. All statistics are cleared.

Specified by:
reset in class DataAccumulator

setBlockSize

public void setBlockSize(long newBlockSize)
Sets the size of the block used to group data for error analysis. Resets statistics accumulated so far. Default is 1000.

Parameters:
blockSize - new block size.

getBlockSize

public long getBlockSize()
Returns the current value of the block size.


processDataInfo

public IEtomicaDataInfo processDataInfo(IEtomicaDataInfo incomingDataInfo)
Prepares the accumulator for input data. Discards any previous contributions to statistics.

Specified by:
processDataInfo in class DataProcessor
Parameters:
incomingDataInfo - the DataInfo instance for the data that will be given to addData
Returns:
the DataInfo of the Data that will be output by this DataProcessor

addDataSink

public void addDataSink(IDataSink newDataSink,
                        AccumulatorAverage.StatType[] types)
Adds a new DataSink that will receive a specific subset of the statistics generated by this accumulator. The DataSink will be given a DataGroup that has only the specified statistics in it. The output of this accumulator is passed through a DataGroupFilter that removes the unwanted Data.

Parameters:
newDataSink - the new DataSink
types - array indicating the statistics to be included in the DataGroup sent to the sink.

getBlockCount

public long getBlockCount()
Returns the number of blocks that have been accumulated since construction or the last call to reset.