SystemML Class
std/2009/resample/spikes
Summary
Resampler for spikes data
Status
Stable

Overview

Resampler for spikes data. The process is not parametrized, and simply moves all input spikes forward in time, if necessary, until the next possible output sample time. Thus, if two spikes occur on the same input stream in one output sample, only one output spike is produced.

Notes

One resampling process can resample as many streams as you plug into it, but they must have different names or an error will be generated. You can achieve this with code of the sort below.

M Source Code (against 995)
% if the output names you plug in are different sys = sys.link('a>a', 'resamp'); sys = sys.link('b>b', 'resamp'); % if the output names you plug in are the same sys = sys.link('a>out', 'resamp<a'); sys = sys.link('b>out', 'resamp<b');

Connectivity

  • N inputs, the source data streams.
  • N outputs, the resampled data streams.

State

This Process takes no parameters.

Example

Script

M Source Code (against 995)
fS = 1000; fS2 = 20; nstreams = 100; nspikes = 100; sys = sml_system; t = floor(rand(nspikes, 1)*fS); s = floor(rand(nspikes, 1)*nstreams); t = sort(t); state = []; state.fS = fS; state.t = [0 fS]; state.s = [0 nstreams]; state.ts = [t s]'; sys = sys.addprocess('src', 'std/2009/source/spikes', fS, state); sys = sys.addprocess('resamp', 'std/2009/resample/spikes', fS2, []); sys = sys.link('src>out', 'resamp'); exe = brahms_execution; exe.all = true; exe.stop = 1; out = brahms(sys, exe); clf hold on plot(double(out.src.out.ts(1,:)) / fS, out.src.out.ts(2,:), 'k.') plot(double(out.resamp.out.ts(1,:)) / fS2, out.resamp.out.ts(2,:), 'r.') xlabel('time (samples)') ylabel('stream')

Expected Output