|
@@ -554,12 +554,16 @@ def plot_polar_plot_excitatory(traj, plot_run_names, selected_neuron_idx,
|
|
|
|
|
|
line_styles = ['dotted', 'solid', 'dashed']
|
|
|
colors = ['r', 'lightsalmon', 'grey']
|
|
|
+ labels = ['polar ', 'circ. ', 'no inh.']
|
|
|
line_widths = [1.5, 1.5, 1]
|
|
|
zorders = [10, 2, 1]
|
|
|
|
|
|
max_rate = 0.0
|
|
|
+ ax.plot([], [], color='white',label=' HDI')
|
|
|
+
|
|
|
for run_idx, run_name in enumerate(plot_run_names):
|
|
|
- label = traj.derived_parameters.runs[run_name].morphology.morph_label
|
|
|
+ # label = traj.derived_parameters.runs[run_name].morphology.morph_label
|
|
|
+ label = labels[run_idx]
|
|
|
hdi = traj.results.runs[run_name].head_direction_indices[selected_neuron_idx]
|
|
|
|
|
|
tuning_vectors = traj.results.runs[run_name].tuning_vectors
|
|
@@ -580,7 +584,7 @@ def plot_polar_plot_excitatory(traj, plot_run_names, selected_neuron_idx,
|
|
|
ax.set_thetagrids([0, 90, 180, 270], labels=[])
|
|
|
ax.xaxis.grid(linewidth=0.4)
|
|
|
ax.yaxis.grid(linewidth=0.4)
|
|
|
- leg = ax.legend(loc="lower right", bbox_to_anchor=(1.15, -0.15), handlelength=1, fontsize="medium")
|
|
|
+ leg = ax.legend(loc="lower right", bbox_to_anchor=(1.15, -0.2), handlelength=1, fontsize="medium")
|
|
|
leg.get_frame().set_linewidth(0.0)
|
|
|
ax.axes.spines["polar"].set_visible(False)
|
|
|
if save_figs:
|
|
@@ -603,13 +607,19 @@ def plot_polar_plot_inhibitory(traj, plot_run_names, selected_neuron_idx, fignam
|
|
|
|
|
|
line_styles = ['dotted', 'solid']
|
|
|
colors = ['b', 'lightblue']
|
|
|
+ labels = ['polar ', 'circ. ']
|
|
|
+
|
|
|
line_widths = [1.5, 1.5]
|
|
|
zorders = [10, 2]
|
|
|
|
|
|
+ ax.plot([], [], color='white',label=' HDI')
|
|
|
+ hdis = []
|
|
|
for run_idx, run_name in enumerate(plot_run_names[:2]):
|
|
|
# ax = axes[max_hdi_idx, run_idx]
|
|
|
- label = traj.derived_parameters.runs[run_name].morphology.morph_label
|
|
|
+ # label = traj.derived_parameters.runs[run_name].morphology.morph_label
|
|
|
+ label = labels[run_idx]
|
|
|
hdi = traj.results.runs[run_name].inh_head_direction_indices[selected_neuron_idx]
|
|
|
+ hdis.append(hdi)
|
|
|
|
|
|
tuning_vectors = traj.results.runs[run_name].inh_tuning_vectors
|
|
|
rate_plot = [np.linalg.norm(v) for v in tuning_vectors[plot_n_idx]]
|
|
@@ -628,6 +638,9 @@ def plot_polar_plot_inhibitory(traj, plot_run_names, selected_neuron_idx, fignam
|
|
|
ax.yaxis.grid(linewidth=0.4)
|
|
|
leg = ax.legend(loc="lower right", bbox_to_anchor=(1.15, -0.15), handlelength=1, fontsize="medium")
|
|
|
leg.get_frame().set_linewidth(0.0)
|
|
|
+
|
|
|
+ # hdi_box = ax.text(1.15, -0.15, 'HDI \n{:.2f} \n{:.2f}'.format(hdis[0], hdis[1]))
|
|
|
+
|
|
|
ax.axes.spines["polar"].set_visible(False)
|
|
|
|
|
|
if save_figs:
|
|
@@ -1121,7 +1134,7 @@ def filter_run_names_by_par_dict(traj, par_dict):
|
|
|
return run_name_list
|
|
|
|
|
|
|
|
|
-def plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, plot_run_names):
|
|
|
+def plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, plot_run_names, cut_off_dist):
|
|
|
corr_len_expl = traj.f_get('correlation_length').f_get_range()
|
|
|
seed_expl = traj.f_get('seed').f_get_range()
|
|
|
label_expl = [traj.derived_parameters.runs[run_name].morphology.morph_label for run_name in traj.f_get_run_names()]
|
|
@@ -1134,13 +1147,28 @@ def plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, plot_run_names):
|
|
|
|
|
|
for run_name, corr_len, seed, label in zip(plot_run_names, corr_len_expl, seed_expl, label_expl):
|
|
|
ex_tunings = traj.results.runs[run_name].ex_tunings
|
|
|
- head_direction_indices = traj.results[run_name].head_direction_indices
|
|
|
- # TODO: Actual correlation lengths
|
|
|
- # actual_corr_len = get_correlation_length(ex_tunings.reshape((30,30)), 450, 30)
|
|
|
- exc_hdi_frame[corr_len, seed, label] = np.mean(head_direction_indices)
|
|
|
+ inh_hdis = []
|
|
|
+ exc_hdis = []
|
|
|
+
|
|
|
+ inh_head_direction_indices = traj.results.runs[run_name].inh_head_direction_indices
|
|
|
+ inh_axonal_cloud = traj.results.runs[run_name].inhibitory_axonal_cloud_array
|
|
|
+ inh_cut_off_ids = (inh_axonal_cloud[:, 0] >= cut_off_dist) & \
|
|
|
+ (inh_axonal_cloud[:, 0] <= traj.parameters.map.sheet_size - cut_off_dist) & \
|
|
|
+ (inh_axonal_cloud[:, 1] >= cut_off_dist) & \
|
|
|
+ (inh_axonal_cloud[:, 1] <= traj.parameters.map.sheet_size - cut_off_dist)
|
|
|
+ inh_hdis.append(sorted(inh_head_direction_indices[inh_cut_off_ids]))
|
|
|
|
|
|
- inh_head_direction_indices = traj.results[run_name].inh_head_direction_indices
|
|
|
- inh_hdi_frame[corr_len, seed, label] = np.mean(inh_head_direction_indices)
|
|
|
+ exc_head_direction_indices = traj.results.runs[run_name].head_direction_indices
|
|
|
+ ex_positions = traj.results.runs[run_name].ex_positions
|
|
|
+ exc_cut_off_ids = (ex_positions[:, 0] >= cut_off_dist) & \
|
|
|
+ (ex_positions[:, 0] <= traj.parameters.map.sheet_size - cut_off_dist) & \
|
|
|
+ (ex_positions[:, 1] >= cut_off_dist) & \
|
|
|
+ (ex_positions[:, 1] <= traj.parameters.map.sheet_size - cut_off_dist)
|
|
|
+ exc_hdis.append(sorted(exc_head_direction_indices[exc_cut_off_ids]))
|
|
|
+
|
|
|
+ exc_hdi_frame[corr_len, seed, label] = np.mean(exc_hdis)
|
|
|
+
|
|
|
+ inh_hdi_frame[corr_len, seed, label] = np.mean(inh_hdis)
|
|
|
|
|
|
# TODO: Standard deviation also for the population
|
|
|
exc_hdi_n_and_seed_mean = exc_hdi_frame.groupby(level=[0, 2]).mean()
|
|
@@ -1209,7 +1237,7 @@ def plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, plot_run_names):
|
|
|
inh_hdi_mean + inh_hdi_std, alpha=0.3, color=inh_col)
|
|
|
|
|
|
ax.set_xlabel('simplex grid scale')
|
|
|
- ax.set_ylabel('head direction index')
|
|
|
+ ax.set_ylabel('HDI')
|
|
|
ax.axvline(get_closest_correlation_length(traj, 200.0) * np.sqrt(2), color='k', linewidth=0.5, zorder=0)
|
|
|
ax.set_ylim(0.0, 1.0)
|
|
|
# ax.set_xlim(0.0, np.max(corr_len_range))
|
|
@@ -1226,7 +1254,7 @@ def plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, plot_run_names):
|
|
|
plt.savefig(FIGURE_SAVE_PATH + 'F_hdi_over_grid_scale.png')
|
|
|
plt.close(fig)
|
|
|
|
|
|
-def plot_exc_and_inh_hdi_over_fit_corr_len(traj, plot_run_names):
|
|
|
+def plot_exc_and_inh_hdi_over_fit_corr_len(traj, plot_run_names, cut_off_dist):
|
|
|
corr_len_expl = traj.f_get('correlation_length').f_get_range()
|
|
|
seed_expl = traj.f_get('seed').f_get_range()
|
|
|
label_expl = [traj.derived_parameters.runs[run_name].morphology.morph_label for run_name in traj.f_get_run_names()]
|
|
@@ -1239,13 +1267,29 @@ def plot_exc_and_inh_hdi_over_fit_corr_len(traj, plot_run_names):
|
|
|
|
|
|
for run_name, corr_len, seed, label in zip(plot_run_names, corr_len_expl, seed_expl, label_expl):
|
|
|
ex_tunings = traj.results.runs[run_name].ex_tunings
|
|
|
- head_direction_indices = traj.results[run_name].head_direction_indices
|
|
|
- # TODO: Actual correlation lengths
|
|
|
- # actual_corr_len = get_correlation_length(ex_tunings.reshape((30,30)), 450, 30)
|
|
|
- exc_hdi_frame[corr_len, seed, label] = np.mean(head_direction_indices)
|
|
|
|
|
|
- inh_head_direction_indices = traj.results[run_name].inh_head_direction_indices
|
|
|
- inh_hdi_frame[corr_len, seed, label] = np.mean(inh_head_direction_indices)
|
|
|
+ inh_hdis = []
|
|
|
+ exc_hdis = []
|
|
|
+
|
|
|
+ inh_head_direction_indices = traj.results.runs[run_name].inh_head_direction_indices
|
|
|
+ inh_axonal_cloud = traj.results.runs[run_name].inhibitory_axonal_cloud_array
|
|
|
+ inh_cut_off_ids = (inh_axonal_cloud[:, 0] >= cut_off_dist) & \
|
|
|
+ (inh_axonal_cloud[:, 0] <= traj.parameters.map.sheet_size - cut_off_dist) & \
|
|
|
+ (inh_axonal_cloud[:, 1] >= cut_off_dist) & \
|
|
|
+ (inh_axonal_cloud[:, 1] <= traj.parameters.map.sheet_size - cut_off_dist)
|
|
|
+ inh_hdis.append(sorted(inh_head_direction_indices[inh_cut_off_ids]))
|
|
|
+
|
|
|
+ exc_head_direction_indices = traj.results.runs[run_name].head_direction_indices
|
|
|
+ ex_positions = traj.results.runs[run_name].ex_positions
|
|
|
+ exc_cut_off_ids = (ex_positions[:, 0] >= cut_off_dist) & \
|
|
|
+ (ex_positions[:, 0] <= traj.parameters.map.sheet_size - cut_off_dist) & \
|
|
|
+ (ex_positions[:, 1] >= cut_off_dist) & \
|
|
|
+ (ex_positions[:, 1] <= traj.parameters.map.sheet_size - cut_off_dist)
|
|
|
+ exc_hdis.append(sorted(exc_head_direction_indices[exc_cut_off_ids]))
|
|
|
+
|
|
|
+ exc_hdi_frame[corr_len, seed, label] = np.mean(exc_hdis)
|
|
|
+
|
|
|
+ inh_hdi_frame[corr_len, seed, label] = np.mean(inh_hdis)
|
|
|
|
|
|
# TODO: Standard deviation also for the population
|
|
|
exc_hdi_n_and_seed_mean = exc_hdi_frame.groupby(level=[0, 2]).mean()
|
|
@@ -1270,7 +1314,7 @@ def plot_exc_and_inh_hdi_over_fit_corr_len(traj, plot_run_names):
|
|
|
# linestyles = ['solid', 'dashed', 'solid']
|
|
|
# markers = [verts, '', 'o']
|
|
|
|
|
|
- corr_len_fit_dict = correlation_length_fit_dict(traj, load=True)
|
|
|
+ corr_len_fit_dict = correlation_length_fit_dict(traj, map_type='perlin', load=True)
|
|
|
|
|
|
width = 2 * panel_size
|
|
|
height = 1.2 * panel_size
|
|
@@ -1315,7 +1359,7 @@ def plot_exc_and_inh_hdi_over_fit_corr_len(traj, plot_run_names):
|
|
|
inh_hdi_mean + inh_hdi_std, alpha=0.3, color=inh_col)
|
|
|
|
|
|
ax.set_xlabel('correlation length')
|
|
|
- ax.set_ylabel('head direction index')
|
|
|
+ ax.set_ylabel('HDI')
|
|
|
ax.axvline(corr_len_fit_dict[get_closest_correlation_length(traj, 200.0)], color='k', linewidth=0.5, zorder=0)
|
|
|
ax.set_ylim(0.0, 1.0)
|
|
|
# ax.set_xlim(0.0, np.max(corr_len_range))
|
|
@@ -1382,7 +1426,7 @@ def plot_spatial_hdi_map(traj, plot_run_names):
|
|
|
print('Mean {}-HDI = {}'.format(label, np.mean(head_direction_indices)))
|
|
|
c = plot_hdi_in_space(ax, positions, head_direction_indices, max_val)
|
|
|
ax.set_title(label)
|
|
|
- fig.colorbar(c, ax=ax, label="head direction index")
|
|
|
+ fig.colorbar(c, ax=ax, label="HDI")
|
|
|
fig.suptitle('spatial HDI map', fontsize=16)
|
|
|
|
|
|
if save_figs:
|
|
@@ -1407,7 +1451,7 @@ def plot_exc_spatial_hdi_map(traj, plot_run_names):
|
|
|
print('Mean {}-HDI = {}'.format(label, np.mean(head_direction_indices)))
|
|
|
c = plot_hdi_in_space(ax, positions, head_direction_indices, max_val)
|
|
|
ax.set_title(label)
|
|
|
- fig.colorbar(c, ax=ax, label="head direction index")
|
|
|
+ fig.colorbar(c, ax=ax, label="HDI")
|
|
|
fig.suptitle('spatial exc. HDI map', fontsize=16)
|
|
|
|
|
|
if save_figs:
|
|
@@ -1433,7 +1477,7 @@ def plot_inh_spatial_hdi_map(traj, plot_run_names):
|
|
|
print('Mean {}-HDI = {}'.format(label, np.mean(head_direction_indices)))
|
|
|
c = plot_hdi_in_space(ax, positions, head_direction_indices, max_val)
|
|
|
ax.set_title(label)
|
|
|
- fig.colorbar(c, ax=ax, label="head direction index")
|
|
|
+ fig.colorbar(c, ax=ax, label="HDI")
|
|
|
fig.suptitle('spatial inh. HDI map', fontsize=16)
|
|
|
|
|
|
if save_figs:
|
|
@@ -1549,7 +1593,7 @@ if __name__ == "__main__":
|
|
|
map_seed = 1
|
|
|
exemplary_head_direction = 0
|
|
|
|
|
|
- # corr_len_fit_dict = correlation_length_fit_dict(traj, load=False)
|
|
|
+ # corr_len_fit_dict = correlation_length_fit_dict(traj, map_type='perlin', load=True)
|
|
|
# plt.plot(corr_len_fit_dict.keys(),corr_len_fit_dict.values())
|
|
|
# plt.show()
|
|
|
# abbrechen
|
|
@@ -1646,9 +1690,9 @@ if __name__ == "__main__":
|
|
|
|
|
|
plot_orientation_maps_diff_scales_with_ellipse(traj)
|
|
|
|
|
|
- plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, traj.f_get_run_names())
|
|
|
+ plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, traj.f_get_run_names(), cut_off_dist=100.)
|
|
|
|
|
|
- plot_exc_and_inh_hdi_over_fit_corr_len(traj, traj.f_get_run_names())
|
|
|
+ plot_exc_and_inh_hdi_over_fit_corr_len(traj, traj.f_get_run_names(), cut_off_dist=100.)
|
|
|
|
|
|
if not save_figs:
|
|
|
plt.show()
|