PeakDetector
Inputs: i1
Outputs: o1
Finds a local maximum (PEAK) within the time window specified by the provided integer (n).
The PeakDetector
operator holds a message buffer on i1
with a size defined by the length of
the provided integer (n). Once the message buffer on i1
gets filled it calculates the PEAK
and emits a message through o1
right after the message buffer on i1
gets filled. The value
field of the emitted message is the calculated PEAK and the time field is the time of the
newest message on the buffer.
The implementation uses a robust local extreme definition: if the message in the middle of the time window has a value such that it is larger than any other message value then it is considered that it is a good local extreme. Typical job is to find the optimal time window size according to the application.
Parameters
id: The id of the operator
n: The window size, in grid steps, to be used in the computation.
Usage
- TypeScript
- Python
- C++
- YAML
- Json
import { Program, PeakDetector } from "@rtbot-dev/rtbot";
const id = "id";
const n = 3;
const program = new Program();
program.addOperator(new PeakDetector(id, n));
import rtbot as rb
id = "id";
n = 3;
program = rb.Program()
program.addOperator(rb.PeakDetector(id, n))
#include "rtbot/PeakDetector.h"
auto id = "id";
auto n = 3;
auto op = PeakDetector<std::uint64_t, double>(id, n)
# minimal RtBot program
operators:
- type: PeakDetector
id: "id"
n: 3
{
"operators": [
{ "type": "PeakDetector", "id": "id", "n": 3 }
]
}