dur = 0.1 dt = 1e-6 f = 100 bw = 2 * np.pi * f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None comps = 10 if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power, comps) u /= max(u) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 4 d = 0.75 k = 0.01 b1 = b # bias d1 = d # threshold k1 = k # integration constant type1 = 1 # ON-type neuron b2 = -b # bias d2 = -d # threshold k2 = k # integration constant
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) # Test leaky IAF algorithms: b1 = 3.5 # bias d1 = 0.7 # threshold R1 = 10.0 # resistance C1 = 0.01 # capacitance b2 = 3.4 # bias d2 = 0.8 # threshold R2 = 9.0 # resistance C2 = 0.01 # capacitance
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2 * np.pi * f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with no Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 3.5 # bias d = 0.7 # threshold R = 10.0 # resistance C = 0.01 # capacitance try: iaf.iaf_recoverable(u, bw, b, d, R, C) except ValueError('reconstruction condition not satisfied'): sys.exit() M = 5 # number of bins for fast decoding algorithm L = 5 # number of recursions for recursive decoding algorithm
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2 * np.pi * f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'ASDM Input Signal with No Noise' else: fig_title = 'ASDM Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b1 = 3.5 # bias d1 = 0.7 # threshold k1 = 0.01 # scaling factor try: asdm.asdm_recoverable(u, bw, b1, d1, k1) except ValueError('reconstruction condition not satisfied'): sys.exit() b2 = 3.4 # bias d2 = 0.8 # threshold k2 = 0.01 # scaling factor
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with no Noise'; else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power; print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 3.5 # bias d = 0.7 # threshold R = 10.0 # resistance C = 0.01 # capacitance try: iaf.iaf_recoverable(u, bw, b, d, R, C) except ValueError('reconstruction condition not satisfied'): sys.exit() M = 31 # 2*M+1 trigonometric polynomials are used in the reconstruction
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with no Noise'; else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power; print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 3.5 # bias d = 0.7 # threshold R = 10.0 # resistance C = 0.01 # capacitance try: iaf.iaf_recoverable(u, bw, b, d, R, C) except ValueError('reconstruction condition not satisfied'): sys.exit() M = 5 # number of bins for fast decoding algorithm L = 5 # number of recursions for recursive decoding algorithm
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 64 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) # Trigonometric polynomial order: M = 75 # Test leaky IAF algorithms: b1 = 7.5 # bias d1 = 0.7 # threshold R1 = 10.0 # resistance C1 = 0.01 # capacitance try: iaf.iaf_recoverable(u, bw, b1, d1, R1, C1)
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2 * np.pi * f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'ASDM Input Signal with No Noise' else: fig_title = 'ASDM Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 3.5 # bias d = 0.7 # threshold k = 0.01 # scaling factor M = 5 # number of bins for fast decoding algorithm try: asdm.asdm_recoverable(u, bw, b, d, k) except ValueError('reconstruction condition not satisfied'): sys.exit() output_count += 1 fig_title = 'Signal Encoded Using ASDM Encoder'
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) # Trigonometric polynomial order: M = 32 # Test leaky IAF algorithms: b1 = 3.5 # bias d1 = 0.7 # threshold R1 = 10.0 # resistance C1 = 0.01 # capacitance try: iaf.iaf_recoverable(u, bw, b1, d1, R1, C1)
output_name = 'gen_band_limited_demo_' output_count = 0 output_ext = '.png' print 'creating test signal..' dur = 1.0 fs = 1e4 dt = 1.0/fs f = 10 t = np.arange(0, dur, dt) np.random.seed(0) out_count = 0 fig_title = 'test signal with no noise' print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) np.random.seed(0) output_count += 1 noise_power = 1 fig_title = 'test signal with %d dB of noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) np.random.seed(0) output_count += 1 noise_power = -5
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 64 bw = 2 * np.pi * f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) # Trigonometric polynomial order: M = 75 # Test leaky IAF algorithms: b1 = 7.5 # bias d1 = 0.7 # threshold R1 = 10.0 # resistance C1 = 0.01 # capacitance try: iaf.iaf_recoverable(u, bw, b1, d1, R1, C1) except ValueError('reconstruction condition not satisfied'):
N = 9 # number of neurons # Starting and ending points of interval that is encoded: t_start = 0.02 t_end = t_start+T if t_end > dur: raise ValueError('t_start is too large') k_start = int(np.round(t_start/dt)) k_end = int(np.round(t_end/dt)) t_enc = np.arange(k_start, k_end, dtype=np.float)*dt u_list = [] for i in xrange(M): fig_title_in = fig_title + ' (Signal #' + str(i+1) + ')' print fig_title_in u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power, comps) u /= max(u) u *= 1.5 pl.plot_signal(t_enc, u[k_start:k_end], fig_title_in, output_name + str(output_count) + output_ext) u_list.append(u) output_count += 1 t = np.arange(len(u_list[0]), dtype=np.float)*dt # Define neuron parameters: def randu(a, b, *d): """Create an array of the given shape and propagate it with random samples from a uniform distribution over ``[a, b)``.""" if a >= b:
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'ASDM Input Signal with No Noise' else: fig_title = 'ASDM Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 3.5 # bias d = 0.7 # threshold k = 0.01 # scaling factor M = 5 # number of bins for fast decoding algorithm try: asdm.asdm_recoverable(u, bw, b, d, k) except ValueError('reconstruction condition not satisfied'): sys.exit() output_count += 1
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2 * np.pi * f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) # Test leaky IAF algorithms: b1 = 3.5 # bias d1 = 0.7 # threshold R1 = 10.0 # resistance C1 = 0.01 # capacitance b2 = 3.4 # bias d2 = 0.8 # threshold R2 = 9.0 # resistance C2 = 0.01 # capacitance output_count += 1
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'ASDM Input Signal with No Noise' else: fig_title = 'ASDM Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) # Define encoding parameters: dte = dt quad_method = 'trapz' b = 3.5 # bias d = 0.7 # threshold k = 0.01 # scaling factor # Define real time decoder stitching parameters: N = 10 M = 2 K = 1
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) # Test leaky IAF algorithms: b1 = 3.5 # bias d1 = 0.7 # threshold R1 = 10.0 # resistance C1 = 0.01 # capacitance try: iaf.iaf_recoverable(u, bw, b1, d1, R1, C1) except ValueError('reconstruction condition not satisfied'): sys.exit()
N = 9 # number of neurons # Starting and ending points of interval that is encoded: t_start = 0.02 t_end = t_start + T if t_end > dur: raise ValueError('t_start is too large') k_start = int(np.round(t_start / dt)) k_end = int(np.round(t_end / dt)) t_enc = np.arange(k_start, k_end, dtype=np.float) * dt u_list = [] for i in xrange(M): fig_title_in = fig_title + ' (Signal #' + str(i + 1) + ')' print fig_title_in u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power, comps) u /= max(u) u *= 1.5 pl.plot_signal(t_enc, u[k_start:k_end], fig_title_in, output_name + str(output_count) + output_ext) u_list.append(u) output_count += 1 t = np.arange(len(u_list[0]), dtype=np.float) * dt # Define neuron parameters: def randu(a, b, *d): """Create an array of the given shape and propagate it with random samples from a uniform distribution over ``[a, b)``."""
dur = 0.1 dt = 1e-6 f = 100 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None comps = 10 if noise_power == None: fig_title = 'IAF Input Signal with No Noise' else: fig_title = 'IAF Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power, comps) u /= max(u) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 4 d = 0.75 k = 0.01 b1 = b # bias d1 = d # threshold k1 = k # integration constant type1 = 1 # ON-type neuron b2 = -b # bias d2 = -d # threshold
# Define algorithm parameters and input signal: dur = 0.1 dt = 1e-6 f = 32 bw = 2*np.pi*f t = np.arange(0, dur, dt) np.random.seed(0) noise_power = None if noise_power == None: fig_title = 'ASDM Input Signal with No Noise' else: fig_title = 'ASDM Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b1 = 3.5 # bias d1 = 0.7 # threshold k1 = 0.01 # scaling factor try: asdm.asdm_recoverable(u, bw, b1, d1, k1) except ValueError('reconstruction condition not satisfied'): sys.exit() b2 = 3.4 # bias d2 = 0.8 # threshold k2 = 0.01 # scaling factor