Skip to content
Snippets Groups Projects
Commit 5c699591 authored by Maximilian Schmidt's avatar Maximilian Schmidt
Browse files

Fix issues of figure scripts

parent 82cc6718
No related branches found
No related tags found
1 merge request!1Add all necessary files for the multi-area model
......@@ -239,5 +239,5 @@ if NEURON_DENSITIES_AVAILABLE:
pl.savefig('Fig2_anatomy.eps', dpi=600)
else:
print("Figure 2 can currently not be produced because"
print("Figure 2 can currently not be produced because "
"we cannot publish the underlying raw data.")
......@@ -17,11 +17,21 @@ with open(os.path.join(datapath, 'viscortex_processed_data.json'), 'r') as f:
proc = json.load(f)
density = proc['neuronal_densities']
ordered_density = OrderedDict(
sorted(list(density.items()), key=lambda t: t[1]['overall'], reverse=True))
if density is None:
print("Since we cannot publish the underlying density data, we"
"here hard-code the list of areas sorted by their overall"
"density.")
areas_sorted_density = ['V1', 'V2', 'V3', 'VP', 'V4', 'MT', 'V4t',
'PITv', 'PITd', 'VOT', 'V3A', 'LIP', 'MIP', 'MDP', 'PO', 'PIP',
'MSTl', 'VIP', 'MSTd', 'DP', 'TF', 'FEF', 'CITv', 'CITd', 'AITv',
'AITd', 'STPa', 'STPp', 'FST', '46', '7a', 'TH']
else:
ordered_density = OrderedDict(
sorted(list(density.items()), key=lambda t: t[1]['overall'], reverse=True))
areas_sorted_density = list(ordered_density.keys())
average_indegree = {}
for area in list(ordered_density.keys()):
for area in areas_sorted_density:
s = 0
for pop in population_list:
for source_area in list(area_list):
......@@ -32,7 +42,7 @@ for area in list(ordered_density.keys()):
indegrees = []
num_list = []
for area in list(ordered_density.keys()):
for area in areas_sorted_density:
indegrees.append(average_indegree[area])
num_list.append(M.N[area]['total'])
......
This diff is collapsed.
......@@ -62,8 +62,11 @@ g_abs = create_graph(conn_matrix_abs, area_list)
"""
Determine clusters using the map equation.
"""
# This path determines the location of the infomap
# installation and needs to be provided to execute the script
infomap_path = None
modules, modules_areas, index = apply_map_equation(
conn_matrix, area_list, filename='Model')
conn_matrix, area_list, filename='Model', infomap_path=infomap_path)
f = open('Model.map', 'r')
line = ''
......@@ -113,7 +116,9 @@ for ii in range(1000):
for jj in range(32):
ind = np.extract(np.arange(32) != jj, np.arange(32))
null_model[:, jj][ind] = null_model[:, jj][ind][np.random.shuffle(ind)]
modules, modules_areas, index = apply_map_equation(null_model, area_list, filename='null')
modules, modules_areas, index = apply_map_equation(null_model, area_list,
filename='null',
infomap_path=infomap_path)
g_null = create_graph(null_model, area_list)
mod_list.append(modularity(g_null, modules[index]))
......
......@@ -251,7 +251,7 @@ for target_area in area_list:
source_areas=[source_area],
complete_area_list=area_list,
external=False)
pM = path_length_matrix[indices]
pM = path_length_matrix[indices[:, :-1]]
pM = pM.reshape(
(len(M.structure[target_area]), len(M.structure[source_area])))
imin = np.unravel_index(np.argmin(pM), pM.shape)
......
......@@ -63,8 +63,12 @@ def apply_map_equation(graph_matrix, node_list, filename='', infomap_path=None):
"""
if infomap_path:
os.chdir(infomap_path)
os.system('Infomap --directed --clu --map --verbose ' +
base_dir + '/' + net_fn + ' ' + base_dir)
ret = os.system('./Infomap --directed --clu --map --verbose ' +
base_dir + '/' + net_fn + ' ' + base_dir)
if ret != 0:
raise OSError("Executing infomap failed. Did you install "
"infomap and provide the correct path by "
"defining the variable infomap_path?")
os.chdir(base_dir)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment