chongxi / spiketag

Next generation of spike sorting package for BMI
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

The Binner #47

Open chongxi opened 5 years ago

chongxi commented 5 years ago
chongxi commented 5 years ago

Binner API

binner = Binner(bin_size=33.33, n_id=N, n_bin=B)    # binner initialization (space and time)
binner.input(bmi_output, type='individual_spike')   # internal state update triggered
chongxi commented 5 years ago

Binner Process image

For LSTM: image

chongxi commented 5 years ago

Binner Internal Parameters:

Internal States:

when nbins grows, the binner emits the decode event with its property output. IMPORTANT: make sure that the bmi_output.spk_id is orthogonal

def input(self, bmi_output, type='individual_spike'):
    current_bin = bmi_output.timestamp//self.bin_size
    if current_bin == self.nbins:   # state integrate
        self.count_vec[bmi_output.spk_id, self.nbins] += 1
    elif current_bin > self.nbins:   # state output
        self.nbins += 1
        self.count_vec[bmi_output.spk_id, self.nbins] += 1
        self.count_vec = np.hstack((self.count_vec, self.new_empty_bin))
        self.emit('decode', var=self.output)
@property
def output(self):
    self._output = self.count_vec[:N, -B:]
    return self._output
@property
def new_empty_bin(self):
    return np.zeros((N,1))