|
@@ -1,46 +1,66 @@
|
|
|
import matplotlib.pyplot as plt
|
|
|
import numpy as np
|
|
|
|
|
|
-from scripts.interneuron_placement import create_grid_of_excitatory_neurons, plot_neural_sheet
|
|
|
+from scripts.interneuron_placement import create_grid_of_excitatory_neurons, plot_neural_sheet, \
|
|
|
+ get_correct_position_mesh
|
|
|
from scripts.spatial_maps.orientation_maps.orientation_map import OrientationMap
|
|
|
from pypet import Trajectory
|
|
|
from scripts.spatial_maps.orientation_maps.orientation_map_generator_pypet import DATA_FOLDER, TRAJ_NAME_ORIENTATION_MAPS
|
|
|
+from scripts.spatial_network.orientation_map.run_orientation_map import get_orientation_map, get_uniform_orientation_map
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
- traj = Trajectory(filename=DATA_FOLDER + TRAJ_NAME_ORIENTATION_MAPS + ".hdf5")
|
|
|
-
|
|
|
- traj.f_load(index=-1, load_parameters=2, load_results=2)
|
|
|
-
|
|
|
- corr_len = 800.0
|
|
|
- seed = 1
|
|
|
-
|
|
|
- map_by_params = lambda x, y: x == corr_len and y == seed
|
|
|
-
|
|
|
- idx_iterator = traj.f_find_idx(['corr_len', 'seed'], map_by_params)
|
|
|
-
|
|
|
- # TODO: Since it has only one entry, maybe iterator can be replaced
|
|
|
- for idx in idx_iterator:
|
|
|
- traj.v_idx = idx
|
|
|
- map_angle_grid = traj.crun.map
|
|
|
-
|
|
|
- N_E = 3600
|
|
|
-
|
|
|
- sheet_x = 900
|
|
|
- sheet_y = 900
|
|
|
-
|
|
|
- number_of_excitatory_neurons_per_row = int(np.sqrt(N_E))
|
|
|
-
|
|
|
- map = OrientationMap(number_of_excitatory_neurons_per_row, number_of_excitatory_neurons_per_row,
|
|
|
- corr_len, sheet_x, sheet_y, seed)
|
|
|
- map.angle_grid = map_angle_grid
|
|
|
-
|
|
|
- tuning_map = lambda x, y: map.tuning(x, y)
|
|
|
-
|
|
|
- ex_positions, ex_tunings = create_grid_of_excitatory_neurons(sheet_x, sheet_y,
|
|
|
- number_of_excitatory_neurons_per_row, tuning_map)
|
|
|
-
|
|
|
- plot_neural_sheet(ex_positions, ex_tunings)
|
|
|
+ # traj = Trajectory(filename=DATA_FOLDER + TRAJ_NAME_ORIENTATION_MAPS + ".hdf5")
|
|
|
+ #
|
|
|
+ # traj.f_load(index=-1, load_parameters=2, load_results=2)
|
|
|
+ #
|
|
|
+ # corr_len = 800.0
|
|
|
+ # seed = 1
|
|
|
+ #
|
|
|
+ # map_by_params = lambda x, y: x == corr_len and y == seed
|
|
|
+ #
|
|
|
+ # idx_iterator = traj.f_find_idx(['corr_len', 'seed'], map_by_params)
|
|
|
+ #
|
|
|
+ # # TODO: Since it has only one entry, maybe iterator can be replaced
|
|
|
+ # for idx in idx_iterator:
|
|
|
+ # traj.v_idx = idx
|
|
|
+ # map_angle_grid = traj.crun.map
|
|
|
+ #
|
|
|
+ # N_E = 3600
|
|
|
+ #
|
|
|
+ # sheet_x = 900
|
|
|
+ # sheet_y = 900
|
|
|
+ #
|
|
|
+ # number_of_excitatory_neurons_per_row = int(np.sqrt(N_E))
|
|
|
+ #
|
|
|
+ # map = OrientationMap(number_of_excitatory_neurons_per_row, number_of_excitatory_neurons_per_row,
|
|
|
+ # corr_len, sheet_x, sheet_y, seed)
|
|
|
+ # map.angle_grid = map_angle_grid
|
|
|
+ #
|
|
|
+ # tuning_map = lambda x, y: map.tuning(x, y)
|
|
|
+
|
|
|
+ # corr_lens = [200.0, 400., 800.]
|
|
|
+ # seed = 1
|
|
|
+
|
|
|
+ corr_lens = np.linspace(1.0, 800.0, 12, endpoint=True).tolist()
|
|
|
+ seed_range = range(10)
|
|
|
+
|
|
|
+ size = 900
|
|
|
+ dim = 60
|
|
|
+
|
|
|
+ fig, axes = plt.subplots(len(corr_lens), len(seed_range))
|
|
|
+
|
|
|
+ for c_id, corr_len in enumerate(corr_lens):
|
|
|
+ for s_id, seed in enumerate(seed_range):
|
|
|
+ tuning_map = get_uniform_orientation_map(corr_len, seed, size, dim*dim)
|
|
|
+
|
|
|
+ ex_positions, ex_tunings = create_grid_of_excitatory_neurons(size, size, dim, tuning_map)
|
|
|
+
|
|
|
+ X, Y = get_correct_position_mesh(ex_positions)
|
|
|
+
|
|
|
+ n_ex = dim
|
|
|
+ head_dir_preference = np.array(ex_tunings).reshape((n_ex, n_ex))
|
|
|
+ c = axes[c_id, s_id].pcolor(X, Y, head_dir_preference, vmin=-np.pi, vmax=np.pi, cmap="twilight")
|
|
|
+ fig.colorbar(c, ax=axes[c_id, s_id], label="Orientation")
|
|
|
+ axes[c_id, s_id].set_aspect('equal')
|
|
|
plt.show()
|
|
|
-
|
|
|
- traj.f_restore_default()
|