Browse Source

Fix jupyter notebooks

- remove output
- use "som02_example" as simulation name
- set command line parameters for learning topographic maps with gaussian stimulus set
- calculate topographic maps from simulation results
Frank/Phenom 4 years ago
parent
commit
44a0ba56c3
2 changed files with 66 additions and 392 deletions
  1. 42 317
      python/ipynb/calc_maps.ipynb
  2. 24 75
      python/ipynb/run_objsim_with_gaussian_input.ipynb

File diff suppressed because it is too large
+ 42 - 317
python/ipynb/calc_maps.ipynb


+ 24 - 75
python/ipynb/run_objsim_with_gaussian_input.ipynb

@@ -2,26 +2,18 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
-    "simname = \"som02_gaussian\""
+    "simname = \"som02_example\""
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "directory exists: /home/frank/data/sim/objsim/som02_gaussian\n"
-     ]
-    }
-   ],
+   "outputs": [],
    "source": [
     "from objsimpy.config import SIMDATA_BASE_DIR, OBJSIM_DIR\n",
     "import os\n",
@@ -36,22 +28,27 @@
     "data_dir = os.path.join(SIMDATA_BASE_DIR, 'objsim', simname)\n",
     "make_dir_if_needed(data_dir)\n",
     "\n",
-    "simtime = 5000."
+    "simtime = 1000000."
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
     "from objsimpy.runner import ObjsimRunner\n",
-    "n_steps = int(simtime//250)\n",
+    "n_trials = 4\n",
+    "n_steps = int(simtime//250//n_trials)\n",
     "default_settings_file = os.path.join(OBJSIM_DIR, 'simulations', 'fm', 'som02', 'settings_som02_gauss.cfg')\n",
     "\n",
     "# default settings from .cfg file can be overwritten\n",
-    "changed_settings = ['--NTrials', '1',\n",
+    "changed_settings = ['--NTrials', '4',\n",
     "                    '--NSteps', str(n_steps),\n",
+    "                    #'--TestNSteps', '4',\n",
+    "                    '--SaveInitialWeights',\n",
+    "                    '--LearnRate', '0.0002',\n",
+    "                    '--StimFileName', 'gauss20x20',\n",
     "                    ]\n",
     "\n",
     "som02_binary = os.path.join(OBJSIM_DIR, 'install', 'bin', 'som02', 'som02')\n",
@@ -63,39 +60,18 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "True"
-      ]
-     },
-     "execution_count": 4,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "som02.is_running()"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "int main(): dt = 0.25\n",
-      "Setup InvLayer \n",
-      ".................\n"
-     ]
-    }
-   ],
+   "outputs": [],
    "source": [
     "fname_output = os.path.join(data_dir, 'output.txt')\n",
     "def print_last_output_lines(fname, n_lines=3):\n",
@@ -109,7 +85,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -118,7 +94,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 15,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -139,45 +115,18 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 18,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "False"
-      ]
-     },
-     "execution_count": 18,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "som02.is_running()"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "backup_settings                     MovieScanInput0.inp.datTEST0\r\n",
-      "error.txt                           output.txt\r\n",
-      "InhibitionLayer.info                RepresentationLayer.info\r\n",
-      "InhibitionLayerspikes.dat.bin       RepresentationLayerspikes.dat.bin\r\n",
-      "InhibitionLayerspikes.datTEST0.bin  RepresentationLayerspikes.datTEST0.bin\r\n",
-      "InputLayer0.info                    SimModInvarLayer.info\r\n",
-      "InputLayer0spikes.dat.bin           SimModInvarLayerspikes.datTEST0.bin\r\n",
-      "InputLayer0spikes.datTEST0.bin      Sim.SimInfo\r\n",
-      "MovieScanInput0.inp.dat\r\n"
-     ]
-    }
-   ],
+   "outputs": [],
    "source": [
     "ls $data_dir"
    ]
@@ -206,7 +155,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.9"
+   "version": "3.7.5"
   }
  },
  "nbformat": 4,