Browse Source

Document compiling and running of simulations, add jupyter start script

Frank/Phenom 4 years ago
parent
commit
305d015bfd
3 changed files with 69 additions and 0 deletions
  1. 18 0
      env/activate_python_env_EXAMPLE.sh
  2. 33 0
      readme.md
  3. 18 0
      start_jupyter.sh

+ 18 - 0
env/activate_python_env_EXAMPLE.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Adjust CONDADIR to point to your anaconda installation
+CONDADIR=$HOME/anaconda/bin
+
+export PATH="$CONDADIR:$PATH"
+export ENVNAME=objsim
+# example for anaconda, using "source activate"
+source activate $ENVNAME
+
+if [ $? -ne 0 ]
+then
+  conda create --name $ENVNAME scipy numpy matplotlib jupyter
+  source activate $ENVNAME
+fi
+
+# alternative for virtualenvwrapper is to use "workon"
+# workon $ENVNAME

+ 33 - 0
readme.md

@@ -7,3 +7,36 @@ Object Recognition"](https://doi.org/10.1152/jn.90651.2008),
   Frank Michler, Reinhard Eckhorn, and Thomas Wachtler (2009)
 - ["Adaptive Feedback Inhibition Improves Pattern Discrimination Learning"](https://doi.org/10.1007/11829898_3)
   Frank Michler, Thomas Wachtler, Reinhard Eckhorn (2006)
+
+## Compiling
+
+Running `build_all.sh` will compile:
+  
+  - the simulation library `csim` (source code is in `src`)
+  - simulation main programs:
+      - `simulations/fm/som02/som02.cpp` which was used in [Frank Michler et al. (2009)](https://doi.org/10.1152/jn.90651.2008)
+      - `minimal/minimal.cpp` is a minimal simulation program demonstrating how to use the library.
+  - some unit tests in `mycxxtests` using the cxxtest library
+
+Binaries will be installed in `install`.
+
+## Running via command line
+
+You can run the simulations via:
+
+```
+cd install/bin/som02
+./som02
+```
+
+settings_som02.cfg contains default simulation parameters that can be overwritten via command line arguments.
+
+## Running via Jupyter noteooks
+
+`start_jupyter.sh` starts jupyter notebook in subdirectory `python`.
+The notebook `python/ipynb/run_objsim_with_gaussian_input.ipynb` 
+Before you must provide a shell script in `env/activate_python_env.sh` to setup your python environment.
+You can use `env/activate_python_env_EXAMPLE.sh` as an example.
+
+`python/ipynb/calc_maps.ipynb` demonstrates how to load simulation data and calculate topographic maps.
+

+ 18 - 0
start_jupyter.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+SETUP_PY_ENV=$DIR/env/activate_python_env.sh
+EXAMPLE_PY_ENV=$DIR/env/activate_python_env_EXAMPLE.sh
+
+if [ -f $SETUP_PY_ENV ]
+then
+  . $SETUP_PY_ENV
+  cd $DIR/python
+  PYTHONPATH=$DIR/python jupyter notebook
+else
+  echo "$SETUP_PY_ENV not found. You can use $EXAMPLE_PY_ENV as a starting point for your own." 1>&2
+  exit 1
+fi
+