Skip to main content

GET_SPIKE

Syntax​

GET_SPIKE <ch> or GET_SPIKE ALL

Description​

Reads the spike statistics of one channel, or a summary of all channels. Spike detection must have been started with SPIKE ON.

Response​

One channel:

SPIKE <ch> en=<0|1> count=<n> rate_1s=<Hz> rate_ring=<Hz> last_ts=<ms> last_amp=<n> ring=<n> ready=<0|1>
FieldDescription
en1 if detection is enabled on this channel.
countTotal spikes since SPIKE ON.
rate_1sSpike rate over the last second (Hz).
rate_ringSpike rate over a longer rolling window (Hz).
last_tsTime of the last spike, in ms since START.
last_ampAmplitude of the last spike (raw counts).
ringNumber of spikes in the rolling window.
ready1 once at least one spike has been detected.

All channels, on one line:

SPIKE_ALL en=<0|1> k=<k> pol=<pol> mask=0x<hex> <ch>:<count>/<rate_1s>/<rate_ring> ...

When detection is on, only the channels of the mask are listed.

Errors​

ReplyCondition
ERR GET_SPIKE bad_argMissing argument or channel out of range.

Example​

get_spike.py
from hmcls_udp import Board

board = Board("192.168.1.11")
line = board.query("GET_SPIKE ALL")[0]
for item in line.split()[5:]:
ch, stats = item.split(":")
count, r1s, rring = stats.split("/")
print(f"channel {ch}: {count} spikes, {r1s} Hz")