Class IDIManager
java.lang.Object
clickTrainDetector.clickTrainAlgorithms.mht.mhtvar.IDIManager
Calculates the inter-detection interval (IDI) (usually clicks) interval for a set of data
units based either on the time stamp or a more complex sample rate and cross
correlation calculation.
This is an important class in which all time calculations for tracks are based. It holds a master time list of all detections considered by the algorithm. The inter-click interval for an individual track is then calculated form this master list. This ensures that the no access to the data blocks and the list iterators which slow everything down are required by the MHT algorithms
- Author:
- Jamie Macaulay
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDetection
(PamDataUnit detection, int kcount) Add a detection to the ICIManager and update the master time series.double
calcTime
(PamDataUnit pamDataUnitPrev, PamDataUnit pamDataUnitNext) Calculate the time between two data unitsdouble
calcTimeSR
(PamDataUnit pamDataUnitPrev, PamDataUnit pamDataUnitNext) Calculate the time between two data unitsvoid
clear()
Clear all the info from the ICIManager.Get the correlation manager.double
getIDIMedian
(BitSet bitSet) Get the IDI series for a track in secondsdouble[]
getIDISeries
(BitSet bitSet) Get the IDI series for a track in secondsgetIDIStruct
(BitSet bitSet) Get the IDI series for a track in secondsdouble
Get the last time in seconds from the time series start.double
getLastTime
(BitSet bitSet) Get the last positive detection time for a given track BitSet.double[]
Get the master time series.double
getTimeDiff
(BitSet bitSet) Get the time difference in seconds between the current last data unit and the last data unit a trackdouble[]
getTimeSeries
(BitSet bitSet) Get the time series for a track in secondsdouble
The total time of the current set of detections.boolean
Check whether force calc flag is set.boolean
Check whether calculation is using cross correlation to increase ICI accuracystatic void
printICISeries
(double[] timeSeries) Print out double arraystatic void
printTimeSeries
(double[] timeSeries) Print out double arrayvoid
setDataUnitList
(ArrayList<PamDataUnit> dataUnits, boolean useCorrelation) Set the current data unit list.void
setForceCalc
(boolean forceCalc) Set the force calc flag.void
setUseCorrelation
(boolean useCorrelation) Set whether calculation is using cross correlation to increase ICI accuracystatic double[]
timeSeries2IDI
(double[] timeSeries) Simple conversation of a time series to an inter detection interval series/void
trimData
(int newRefIndex) Trims the front of all arrays to the specified index.
-
Constructor Details
-
IDIManager
public IDIManager()Constructor for the ICIManager.
-
-
Method Details
-
addDetection
Add a detection to the ICIManager and update the master time series.- Parameters:
detection
- - the current detection ion the kernelkcount
- - the current kernel kcount. This should match ICICount
-
getLastTime
public double getLastTime()Get the last time in seconds from the time series start. This is the last time of the last data unit to be added to the hypothesis mix. It is NOT the last time of the last hypothesis.- Returns:
- the last time in seconds from the time series start.
-
setDataUnitList
Set the current data unit list. Sets the current list and calculates time, ICI and correlation series values. Note: if the useCorrelation is set to false then all correlation series values will be set to zero.- Parameters:
dataUnits
- - the data units to set.useCorrelation
- - use cross correlation to get more accurate ICI measurements.
-
calcTime
Calculate the time between two data units- Parameters:
pamDataUnitPrev
- - the first data unit (in time)pamDataUnitNext
- - the second data unit (in time)- Returns:
- the time in SECONDS
-
calcTimeSR
Calculate the time between two data units- Parameters:
pamDataUnitPrev
- - the first data unit (in time)pamDataUnitNext
- - the second data unit (in time)- Returns:
- the time in SAMPLES
-
isUseCorrelation
public boolean isUseCorrelation()Check whether calculation is using cross correlation to increase ICI accuracy- Returns:
- true if using correlation to increase ICI accuracy.
-
setUseCorrelation
public void setUseCorrelation(boolean useCorrelation) Set whether calculation is using cross correlation to increase ICI accuracy- Parameters:
useCorrelation
- - true to use cross correlation to increase accuracy.
-
clear
public void clear()Clear all the info from the ICIManager. This deletes the master time list. -
getTimeDiff
Get the time difference in seconds between the current last data unit and the last data unit a track- Returns:
-
getIDISeries
Get the IDI series for a track in seconds- Parameters:
bitSet
- - the track bitset.- Returns:
- the IDI series of the positive track detections.
-
getTimeSeries
Get the time series for a track in seconds- Parameters:
bitSet
- - the track bitset.- Returns:
- the IDI series of the positive track detections.
-
getIDIMedian
Get the IDI series for a track in seconds- Parameters:
bitSet
- - the track bitset.- Returns:
- the IDI series of the positive track detections.
-
getIDIStruct
Get the IDI series for a track in seconds- Parameters:
bitSet
- - the track bitset.- Returns:
- the IDI series of the positive track detections.
-
timeSeries2IDI
public static double[] timeSeries2IDI(double[] timeSeries) Simple conversation of a time series to an inter detection interval series/- Parameters:
timeSeries
- - the time series in seconds- Returns:
- - the inter detection interval in seconds. The size of the array will be one less than the time series array.
-
printTimeSeries
public static void printTimeSeries(double[] timeSeries) Print out double array- Parameters:
timeSeries
-
-
printICISeries
public static void printICISeries(double[] timeSeries) Print out double array- Parameters:
timeSeries
-
-
getMasterTimeSeries
public double[] getMasterTimeSeries()Get the master time series.- Returns:
- the master time series.
-
isForceCalc
public boolean isForceCalc()Check whether force calc flag is set. If true then the IDI manager will recalculate the IDI series whether the bitset is the same or not. This is reset after the calculation to false.- Returns:
- the forceCalc flag.
-
setForceCalc
public void setForceCalc(boolean forceCalc) Set the force calc flag. If true then the IDI manager will recalculate the IDI series whether the bitset is the same or not. This is reset after the calculation to false.- Parameters:
the
- forceCalc flag.
-
trimData
public void trimData(int newRefIndex) Trims the front of all arrays to the specified index. This is used to junk old data that is no longer relevant.- Parameters:
newRefIndex
- - the index to trim to.
-
getCorrelationManager
Get the correlation manager. This handles correlations between data units.- Returns:
- the correlations manager.
-
getLastTime
Get the last positive detection time for a given track BitSet.- Parameters:
bitSet
- - the BitSet.- Returns:
- the positive detection time in SECONDS.
-
getTotalTime
public double getTotalTime()The total time of the current set of detections.- Returns:
- the total time in seconds.
-
getFirstDataUnit
-