Class PeakFinderLocalMaximum
- All Implemented Interfaces:
ca.uqac.lif.cep.Contextualizable,ca.uqac.lif.cep.Duplicable,ca.uqac.lif.cep.DuplicableProcessor
The local maximum method is a brute force searching algorithm which finds the local maximum in a moving window. The window size is determined by a predefined a number of local points.
Initially, an n-point window is placed at the start point of data stream. The maximum in this window, as well as its index, is recorded. Then the window is moved one step further. If the new maximun is greater than the saved maximum, update both the maximum value and index value and then move forward. If the maximum moves out of the window, i.e. all points in the window are less than the maximum, a peak is found an the whole window configuration is reconstructed for the next peak.
For each input event, the processor outputs the height of the peak, or the value 0 if this event is not a peak. Since an event needs to be out of the window to determine that it is a peak, the emission of output events is delayed with respect to the consumption of input events.
By default, the window is of width 5.
-
Nested Class Summary
Nested classes/interfaces inherited from class ca.uqac.lif.cep.SynchronousProcessor
ca.uqac.lif.cep.SynchronousProcessor.InputPushable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullableNested classes/interfaces inherited from class ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.Processor.InternalProcessorState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether to invert the values before computing.protected intThe number of events that went out of the window since the last peak was seen.protected intThe position in the window where the highest value isFields inherited from class ca.uqac.lif.cep.signal.WindowProcessor
m_maxValue, m_minValue, m_values, m_windowWidth, s_precisionFields inherited from class ca.uqac.lif.cep.SynchronousProcessor
m_inputPushables, m_outputPullables, m_tempQueueFields inherited from class ca.uqac.lif.cep.Processor
m_context, m_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class ca.uqac.lif.cep.signal.WindowProcessor
doubleEquals, getMaxValue, getMinValueMethods inherited from class ca.uqac.lif.cep.SynchronousProcessor
getPullableOutput, getPushableInputMethods inherited from class ca.uqac.lif.cep.Processor
allNotifiedEndOfTrace, allNull, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getId, getInputArity, getInputQueue, getInputType, getInputTypesFor, getOutputArity, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, or, printState, readState, rightShift, setContext, setContext, setPullableInput, setPushableOutput, start, startAll, stop, stopAll
-
Field Details
-
m_peakPosition
protected int m_peakPositionThe position in the window where the highest value is -
m_numSincePeak
protected int m_numSincePeakThe number of events that went out of the window since the last peak was seen. -
m_invert
protected boolean m_invertWhether to invert the values before computing. Setting this to true will make the processor detect drops (sudden decreases) instead of peaks.
-
-
Constructor Details
-
PeakFinderLocalMaximum
public PeakFinderLocalMaximum() -
PeakFinderLocalMaximum
public PeakFinderLocalMaximum(int width)
-
-
Method Details
-
findDrops
Sets whether the peak finder detects drops or peaks.- Parameters:
b- Set totrueto detect drops- Returns:
- This processor
-
reset
public void reset()- Overrides:
resetin classWindowProcessor
-
compute
- Specified by:
computein classca.uqac.lif.cep.SynchronousProcessor
-
getPeakPosition
public int getPeakPosition() -
duplicate
- Specified by:
duplicatein interfaceca.uqac.lif.cep.Duplicable- Specified by:
duplicatein classca.uqac.lif.cep.Processor
-
computeOutputValue
- Specified by:
computeOutputValuein classWindowProcessor
-