def normalize(self, values): corr_vector=values[0] norm_pop=values[1] norm_target=values[2] corr_vector[nonzero(self.spikecount.count==0)] = -inf #print self.corr_vector/sqrt(norm_pop)/sqrt(norm_target) return self.corr_vector/sqrt(norm_pop)/sqrt(norm_target)
def inject_input(self): # Injects current in consecutive subgroups, where I_offset have the same value # on successive intervals I_offset = self.inputs_offset k = -1 for i in hstack((nonzero(diff(I_offset))[0], len(I_offset) - 1)): I_offset_subgroup_value = I_offset[i] I_offset_subgroup_length = i - k sliced_subgroup = self.group.subgroup(I_offset_subgroup_length) input_sliced_values = self.inputs_inline[I_offset_subgroup_value:I_offset_subgroup_value + self.total_steps] sliced_subgroup.set_var_by_array(self.input_var, TimedArray(input_sliced_values, clock=self.group.clock)) k = i
def normalize(self, distance_vector): distance_vector[nonzero(self.spikecount.count==0)] = inf return -self.distance_vector*self.group.clock.dt