<jupyter_start><jupyter_text>Define input<jupyter_code>t = 0.4
stim_number = 40
stim_onset = 0.2
stim_offset = 0.25
stim_rate = 8
dt = 1e-5
seed_stim = 1
ns_x, ts_x = util.poisson_impulse(
        t,
        stim_onset,
        stim_offset - stim_onset,
        stim_rate,
        n=stim_number,
        dt=dt,
        seed=None)

print(">>> {} spikes".format(ts_x.size))
print(">>> {} population rate".format(ts_x.size / (stim_offset - stim_onset)))
p = figure(plot_width=400, plot_height=200)
p.circle(ts_x, ns_x, color="black")
p.xaxis.axis_label = 'Time (s)'
p.yaxis.axis_label = 'N'
p.x_range = Range1d(0, t)
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None
show(p)<jupyter_output><empty_output><jupyter_text>- Shadow voltage response of an LIF neuron to the input<jupyter_code>#set mode
mode = 'regular'
params, w_in, bias, sigma = util.read_modes(mode)
bias = np.asarray(bias)
print(w_in, bias, sigma)
# -
M = 20
A = .2e-9
f = 8
b_in = neurons.shadow_adex(M, t, ns_x, ts_x, f=f, A=A, w_in=w_in, bias_in=bias-A/2, sigma=sigma, **params)
times = b_in['times']
v_in = b_in['V_m_thresh']
# -
p = figure(plot_width=400, plot_height=200)
for n in range(10):
    p.line(x=times, y=v_in[n, :], color="black", alpha=0.1)
p.xaxis.axis_label = 'Time (s)'
p.yaxis.axis_label = 'Vm (volts)'
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None
show(p)
combine = False
ns_p, ts_p = locate_peaks(b_in, stim_onset, stim_offset, combine=combine)
# -
p = figure(plot_width=400, plot_height=200)
for n in range(10):
    p.line(x=times, y=v_in[n, :], color="black", alpha=0.1)
    if not combine:
        p.circle(x=ts_p[n], y=v_in[n, :].max(), color="purple")
    else:
        p.line(x=ts_p[0], y=np.linspace(v_in[:, :].min(), v_in[:, :].max(), 10), color="purple")
p.xaxis.axis_label = 'Time (s)'
p.yaxis.axis_label = 'Vm (volts)'
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None
show(p)<jupyter_output><empty_output><jupyter_text>Budget analysis<jupyter_code>budget_y = b_in
times = budget_y['times']

p = figure(plot_width=400, plot_height=200)
for n in range(M):
    v = budget_y['V_m'][n, :]
    p.line(x=times, y=v, color="black", alpha=0.1)
p.xaxis.axis_label = 'Time (s)'
p.yaxis.axis_label = 'Vm (volts)'
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None
show(p)
times = budget_y['times']

p = figure(plot_width=400, plot_height=200)
for n in range(M):
    v = budget_y['V_comp'][n, :]
    p.line(x=times, y=v, color="black", alpha=0.1)
p.xaxis.axis_label = 'Time (s)'
p.yaxis.axis_label = 'Vm (volts)'
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None
show(p)
times = budget_y['times']

Et = -52e-3
p = figure(title="{}".format(A), plot_width=400, plot_height=230)
for n in range(M):
    v = budget_y['V_osc'][n, :] 
    p.line(x=times, y=v, color="black", alpha=0.1)
p.xaxis.axis_label = 'Time (s)'
p.yaxis.axis_label = 'Vm (volts)'
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None
# p.y_range = Range1d(0.05, 0.08)
show(p)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17785123966942148, 'fraction_numerical': 0.027768595041322314, 'mean_word_length': 4.635009310986964, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '456503', 'license': 'MIT', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1339, 'n_words': 249, 'path': 'voltagebudget/ipynb/testing_shadow.ipynb', 'repo_name': 'voytekresearch/voltagebudget', 'size': '3025'}