From e4a6c52deae587488e2448ac2d096b33996722ef Mon Sep 17 00:00:00 2001 From: Maximilian Schmidt <max.schmidt@fz-juelich.de> Date: Thu, 29 Mar 2018 10:11:52 +0900 Subject: [PATCH] Remove absolute path to infomap, improve function and doc, add info to README --- README.md | 4 +++- figures/Schmidt2017/graph_helpers.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c6a31fb..ef40a29 100644 --- a/README.md +++ b/README.md @@ -176,10 +176,12 @@ To install the required packages in a conda environment, execute: Note that NEST needs to be installed separately, see <http://www.nest-simulator.org/installation/>. -In addition, reproducing the figures of Schmidt et al. (2017) requires python-igraph and networkx. To install these additional packages, execute: +In addition, reproducing the figures of [1] requires python-igraph and networkx. To install these additional packages, execute: `pip install -r figures/Schmidt2017/additional_requirements.txt` +In addition, Figure 7 of [1] requires installing the `infomap` package to perform the map equation clustering. See <http://www.mapequation.org/code.html> for all necessary information. + The SLN fit in `multiarea_model/data_multiarea/VisualCortex_Data.py` and `figures/Schmidt2017/Fig5_cc_laminar_pattern.py` requires an installation of R and the R library `aod` (<http://cran.r-project.org/package=aod>). Without R installation, both scripts will directly use the resulting values of the fit (see Fig. 5 of [1]). ## Contributors diff --git a/figures/Schmidt2017/graph_helpers.py b/figures/Schmidt2017/graph_helpers.py index 76c3038..953e5c4 100644 --- a/figures/Schmidt2017/graph_helpers.py +++ b/figures/Schmidt2017/graph_helpers.py @@ -5,7 +5,7 @@ import numpy as np import os -def perform_map_equation(graph_matrix, node_list, filename=''): +def perform_map_equation(graph_matrix, node_list, filename='', infomap_path=None): """ Perform the map equation of Rosvall M, Axelsson D, Bergstrom CT (2009) The map equation. @@ -21,6 +21,9 @@ def perform_map_equation(graph_matrix, node_list, filename=''): the graph_matrix and node_list. filename : str Output file name without ending. + infomap_path : str + Path to installation of infomap. If None, the + infomap executable has to be in the system path. Returns ------- @@ -58,7 +61,8 @@ def perform_map_equation(graph_matrix, node_list, filename=''): """ 2. Execute map equation algorithm """ - os.chdir('/home/schmidt/opt/infomap') + if infomap_path: + os.chdir(infomap_path) os.system('./Infomap --directed --clu --map --verbose ' + base_dir + '/' + net_fn + ' ' + base_dir) -- GitLab