def run_GS(W, b1, b2, n): steps = n from neusa.RBMSampler import RBMGibbsSampler g = RBMGibbsSampler(W, b1, b2) i = np.random.randint(0,2, size=N_h) lv, lh = g.manysteps(i,steps) a=np.hstack([lv,lh]) states = kl_tools.spikes2states(a) return states
def run_GS(W, b1, b2, n): steps = n from neusa.RBMSampler import RBMGibbsSampler g = RBMGibbsSampler(W, b1, b2) i = np.random.randint(0, 2, size=N_h) lv, lh = g.manysteps(i, steps) a = np.hstack([lv, lh]) states = kl_tools.spikes2states(a) return states
def states_NS(Mv, Mh, t_conv=1.0): Sv = monitor_to_spikelist(Mv).time_slice(10*t_ref, t_sim*1000) Sh = monitor_to_spikelist(Mh).time_slice(10*t_ref, t_sim*1000) Sv.time_offset(-10*t_ref) Sh.time_offset(-10*t_ref) Sv.t_start = 0 Sv.t_stop = t_sim*1000 - 10*t_ref Sh.t_start = 0 Sh.t_stop = t_sim*1000 - 10*t_ref Sv.complete(np.arange(N_v)) Sh.complete(np.arange(N_h)) sv = Sv.spike_histogram(time_bin=1.).astype('bool').astype('int') sh = Sh.spike_histogram(time_bin=1.).astype('bool').astype('int') s = np.row_stack([sv, sh]) s_conv = [] for row in s: s_conv.append(np.convolve(row, np.ones([t_conv*t_ref/ms]))) s_conv = np.array(s_conv).T.astype('int') s_conv[s_conv>1]=1 states = kl_tools.spikes2states(s_conv) return states
def states_NS(Mv, Mh, t_conv=1.0): Sv = monitor_to_spikelist(Mv).time_slice(10 * t_ref, t_sim * 1000) Sh = monitor_to_spikelist(Mh).time_slice(10 * t_ref, t_sim * 1000) Sv.time_offset(-10 * t_ref) Sh.time_offset(-10 * t_ref) Sv.t_start = 0 Sv.t_stop = t_sim * 1000 - 10 * t_ref Sh.t_start = 0 Sh.t_stop = t_sim * 1000 - 10 * t_ref Sv.complete(np.arange(N_v)) Sh.complete(np.arange(N_h)) sv = Sv.spike_histogram(time_bin=1.).astype('bool').astype('int') sh = Sh.spike_histogram(time_bin=1.).astype('bool').astype('int') s = np.row_stack([sv, sh]) s_conv = [] for row in s: s_conv.append(np.convolve(row, np.ones([t_conv * t_ref / ms]))) s_conv = np.array(s_conv).T.astype('int') s_conv[s_conv > 1] = 1 states = kl_tools.spikes2states(s_conv) return states