I have two (very) long and sparse boolean arrays n1
and n2
, representing spikes of two neurons that are responding to the same stimulus. Because they are responding to the same stimulus, they have many “overlapping” spikes (up to some t
time-difference); but also because of biological noise they could have uncoupled spikes (tonic properties of each neuron).
I’m looking for a way to map between spikes from n1
and n2
, such that:
- Each spike from
n1
is matched to at most 1 spike fromn2
. - Each spike from
n2
is matched to at most 1 spike fromn1
. - If two spikes from
n2
could match a spike fromn1
, we take the one occurring closer (in time/array index) to then1
spike. - We match as many
n1
spikes as possible.
Given some allowed maximal “jitter” t
, how do I find the best mapping between these two boolean arrays?