Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synaptic weight and k scaling #53

Merged
merged 12 commits into from
Nov 21, 2023
8 changes: 8 additions & 0 deletions figures/MAM2EBRAINS/M2E_compute_corrcoeff.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def compute_corrcoeff(M, data_path, label):
LvR_list = []
N = []
for pop in M.structure[area]:
print(area, pop)
fp = '-'.join((label,
'spikes', # assumes that the default label for spike files was used
area,
Expand All @@ -54,7 +55,14 @@ def compute_corrcoeff(M, data_path, label):
dat = ch.sort_gdf_by_id(spikes, idmin=ids[0], idmax=ids[0]+subsample+1000)
bins, hist = ch.instantaneous_spike_count(dat[1], resolution, tmin=tmin, tmax=T)
rates = ch.strip_binned_spiketrains(hist)[:subsample]
print(rates)
print("test")
print(rates.shape)
cc = np.corrcoef(rates)
print(cc.shape)
print(cc[0].size)
# print(cc[0])
# print(cc)
cc = np.extract(1-np.eye(cc[0].size), cc)
cc[np.where(np.isnan(cc))] = 0.
cc_dict[area][pop] = np.mean(cc)
Expand Down
2 changes: 1 addition & 1 deletion figures/MAM2EBRAINS/M2E_visualize_firing_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def plot_firing_rate(M):
# display the value of mean rate
ax.text(0.7 * max(tsteps), mean_rate+2, f'Mean firing rate: {mean_rate:.2f}', fontsize=12)

ax.set_title('Instantaneous and mean firing rate across all populations', fontsize=15, pad=20)
ax.set_title('Instantaneous and mean firing rate across all populations', fontsize=15, pad=10)
ax.set_xlabel('Time (ms)', fontsize=13)
ax.set_ylabel('Firing rate (spikes / s)', fontsize=12)
ax.set_xlim(0, M.simulation.params['t_sim'])
Expand Down
15 changes: 10 additions & 5 deletions figures/MAM2EBRAINS/M2E_visualize_interareal_connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def visualize_interareal_connectivity(M):
pl.rcParams['figure.figsize'] = (width, height)

fig = pl.figure()
fig.suptitle('Interareal connectivity for full-scale (left) and down-scale (right) multi-area model', fontsize=16, y=1.05)
fig.suptitle('Interareal probabilistic connectivity for full-scale (left) and down-scaled (right) multi-area model', fontsize=16, y=1.05)
axes = {}

# gs1 = gridspec.GridSpec(2, 2)
Expand Down Expand Up @@ -189,8 +189,11 @@ def visualize_interareal_connectivity(M):

ax.set_aspect(1. / ax.get_data_ratio())

masked_matrix_full_scale = np.ma.masked_values(conn_matrix_full_scale, 0.0)
cmap = pl.get_cmap('inferno')
# masked_matrix_full_scale = np.ma.masked_values(conn_matrix_full_scale, 0.0)
masked_matrix_full_scale = conn_matrix_full_scale
print(masked_matrix_full_scale[2])
# cmap = pl.get_cmap('inferno')
cmap = pl.get_cmap('YlOrBr')
cmap.set_bad('w', 1.0)

x = np.arange(0, len(area_list) + 1)
Expand Down Expand Up @@ -320,8 +323,10 @@ def visualize_interareal_connectivity(M):

ax.set_aspect(1. / ax.get_data_ratio())

masked_matrix_down_scale = np.ma.masked_values(conn_matrix_down_scale, 0.0)
cmap = pl.get_cmap('inferno')
# masked_matrix_down_scale = np.ma.masked_values(conn_matrix_down_scale, 0.0)
masked_matrix_down_scale = conn_matrix_down_scale
print(masked_matrix_down_scale[2])
# cmap = pl.get_cmap('inferno')
cmap.set_bad('w', 1.0)

x = np.arange(0, len(area_list) + 1)
Expand Down
3 changes: 2 additions & 1 deletion figures/MAM2EBRAINS/M2E_visualize_time_ave_pop_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def plot_time_averaged_population_rates(M, data_path, area_list=None, **keywords
ax.set_xticklabels(area_list, rotation=90, size=10.)
ax.set_yticks(y_index)
# ax.set_yticklabels(A.network.structure_reversed['V1'])
ax.set_yticklabels(M.structure['V1'][::-1])
# ax.set_yticklabels(M.structure['V1'][::-1])
ax.set_yticklabels(['6I', '6E', '5I', '5E', '4I', '4E', '2/3I', '2/3E'])
ax.set_ylabel('Population', size=13)
ax.set_xlabel('Area index', size=13)
t = FixedLocator([0.01, 0.1, 1., 10., 100.])
Expand Down
3,187 changes: 3,076 additions & 111 deletions multi-area-model.ipynb

Large diffs are not rendered by default.