SPIKE ON
Syntax
SPIKE ON <k> [NEG|POS|BOTH] [refrac_ms] [ALL|MASK <hex>|CH <ch0,ch1,...>]
Description
Starts spike detection on the board. A spike is detected when the signal of a channel exceeds k × σ, where σ is the running RMS of that channel. The RMS is started automatically.
Each detected spike raises an event flag (flag 33 + channel) that a Studio program can test, and updates the per-channel statistics read by GET_SPIKE.
Parameters
| Parameter | Default | Description |
|---|---|---|
<k> | — | Threshold factor, greater than 0. |
NEG | POS | BOTH | NEG | Polarity: negative-going, positive-going, or either. |
refrac_ms | 1.5 | Refractory period in ms: no second spike on the same channel within this time. |
ALL | ALL | Detect on all streamed channels. |
MASK <hex> | — | Channel bitmask; bit N = channel N (for example MASK 0x7 = channels 0, 1, 2). |
CH <a,b,...> | — | Comma-separated list of channels. |
Response
OK SPIKE ON k=<k> pol=<NEG|POS|BOTH> refrac=<ms> fs=<Hz> mask=0x<hex>
Errors
| Reply | Condition |
|---|---|
ERR SPIKE ON bad_arg | k missing or not positive, unknown polarity, or invalid / empty channel selection. |
Example
spike_on.py
from hmcls_udp import Board
board = Board("192.168.1.11")
board.request("SPIKE ON 4.5 NEG 1.5 CH 0,1,2,3")
print(board.query("GET_SPIKE 0"))
board.request("SPIKE OFF")