コード例 #1
0
        step_size=dt,
        permute=True,
        sampling_step_size=dts,
        inputs={
            #'gpe_p/gpe_proto_syns_op/I_ext': ctx,
            #'gpe_a/gpe_arky_syns_op/I_ext': ctx
        },
        outputs={
            'r_i': 'gpe_p/gpe_proto_syns_op/R_i',
            'r_a': 'gpe_a/gpe_arky_syns_op/R_a',
        },
        init_kwargs={
            'backend': 'numpy',
            'solver': 'scipy',
            'step_size': dt
        },
        method='RK45',
    )

    fig2, ax = plt.subplots(figsize=(6, 2.0), dpi=dpi)
    results = results * 1e3
    plot_timeseries(results, ax=ax)
    plt.legend(['GPe-p', 'GPe-a'])
    ax.set_ylabel('Firing rate')
    ax.set_xlabel('time (ms)')
    # ax.set_xlim([000.0, 1500.0])
    # ax.set_ylim([0.0, 100.0])
    ax.tick_params(axis='both', which='major', labelsize=9)
    plt.tight_layout()
    plt.show()
コード例 #2
0
dts = 1e-3                                     # variable storage sub-sampling step size in s
sub = int(dts/dt)                              # sub-sampling rate
T = 800.0                                        # total simulation time in s
#inp = np.zeros((int(T/dt), 1), dtype='float32')                 # external input to the population
#inp[int(20./dt):int((T-20.)/dt)] = 5.

circuit = CircuitTemplate.from_yaml("model_templates.montbrio.simple_montbrio.QIF_sfa_exp"
                                    ).apply(node_values={'p/Op_sfa_exp/eta': -3.96,
                                                         'p/Op_sfa_exp/J': 15.0*np.sqrt(2.0),
                                                         'p/Op_sfa_exp/alpha': 0.7}
                                            )
compute_graph = circuit.compile(vectorization=True, backend='numpy', name='montbrio', solver='scipy')

result, t = compute_graph.run(T,
                              step_size=dt,
                              #inputs={"E/Op_e_adapt/inp": inp},
                              outputs={"r": "p/Op_sfa_exp/r",
                                       "v": "p/Op_sfa_exp/v",
                                       "A": "p/Op_sfa_exp/I_a"},
                              sampling_step_size=dts,
                              profile='t',
                              verbose=True,
                              method='LSODA'
                              )

result.plot()
cmap = create_cmap("inferno", as_cmap=False, n_colors=3)
plot_timeseries(result.loc[10.0:, :], plot_style="ridge_plot", demean=True, hspace=-.01, fontsize=28, aspect=6,
                height=2.0, cmap=cmap)
plt.show()
コード例 #3
0
import matplotlib.pyplot as plt

fig, axes = plt.subplots(nrows=len(param_grid['C']), figsize=(8, 12))

# create the color map
cmap = create_cmap('pyrates_blue', as_cmap=False, n_colors=1, reverse=True)

# sort the results map via the values of C
results_map.sort_values('C', inplace=True)

# plot the raw output variable for each condition
for i, ax in enumerate(axes):
    key = results_map.index[i]
    psp_e = results.loc[1.0:, ('V_pce', key)]
    psp_i = results.loc[1.0:, ('V_pci', key)]
    plot_timeseries(psp_e - psp_i, ax=ax, cmap=cmap, ylabel='PSP')
    ax.legend([f"C = {results_map.at[key, 'C']}"], loc='upper right')

plt.show()

# %%
# Note that, since the parameter values are arranged in a :code:`pandas.DataFrame`, sorting their values is very
# straight forward. For each value of :math:`C` in ascending order, we extract the name of the respective columns in
# :code:`results` to receive our 2 stored output variables. The difference between those two state variables resembles
# the average membrane potential of the PC population of the Jansen-Rit model. This is what we plot for each condition.
# If you compare these results to the results in [1]_, you will notice that they differ. This is, because Jansen and Rit
# used noisy input to the model. To receive the same results as in [1]_, we will have to define extrinsic noise to
# drive the model with. This can be done the following way:

import numpy as np
コード例 #4
0
        'gpe-p': 'gpe_p/stn_op/R',
        'gpe-a': 'gpe_a/stn_op/R',
        'msn-d1': 'msn_d1/stn_op/R',
        'msn-d2': 'msn_d2/stn_op/R',
        'fsi-d1': 'fsi_d1/fsi_op/R',
        'fsi-d2': 'fsi_d2/fsi_op/R'
    },
    # inputs={'stn/stn_op/ctx': amp + ctx,
    #         'msn/str_msn_op/ctx': amp + ctx,
    #         'fsi/str_fsi_op/ctx': amp + ctx}
)

results = results * 1e3
fig, axes = plt.subplots(nrows=2, dpi=200, figsize=(10, 5))
ax = plot_timeseries(results,
                     cmap=create_cmap('cubehelix', as_cmap=False, n_colors=7),
                     ax=axes[0])
#plt.legend(['STN', 'GPe_p', 'GPe_a', 'STR'])
ax.set_title('Healthy Firing Rates')
ax.set_ylabel('firing rate (spikes/s)')
ax.set_xlabel('time (ms)')
#ax.set_ylim(0.0, 100.0)
#ax.set_xlim(20.0, 240.0)
# av_signal = results.loc[:, ('STN', 'stn')] - results.loc[:, ('GPe_proto', 'gpe_p')] - results.loc[:, ('MSN', 'msn')]
# ax = plot_timeseries(av_signal, cmap=create_cmap('cubehelix', as_cmap=False, n_colors=1), ax=axes[1])
# ax.set_title('GPi input (STN - GPe_p - MSN)')
# ax.set_ylabel('firing rate (spikes/s)')
# ax.set_xlabel('time (ms)')
plt.tight_layout()
plt.show()