-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from SpiNNakerManchester/test_base
Moved Integeration tests out of Spynakker
- Loading branch information
Showing
14 changed files
with
261 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,95 @@ | ||
# Cortical microcircuit simulation: PyNN version | ||
_Stored for easy access for people within the organisation_ | ||
|
||
**Contributors:** | ||
Sacha van Albada ([email protected]) | ||
Maximilian Schmidt | ||
Jannis Schücker | ||
**Contributors:** | ||
Sacha van Albada ([email protected]) | ||
Maximilian Schmidt | ||
Jannis Schücker | ||
Andrew Rowley | ||
Alan Stokes | ||
|
||
This is an implementation of the multi-layer microcircuit model of early | ||
sensory cortex published by Potjans and Diesmann (2014) _The cell-type specific | ||
cortical microcircuit: relating structure and activity in a full-scale spiking | ||
network model_. Cerebral Cortex 24 (3): 785-806, [doi:10.1093/cercor/bhs358](https://doi.org/10.1093/cercor/bhs358) | ||
|
||
It has been run on three different back-ends: NEST, SpiNNaker, and the ESS (emulator of HMF) | ||
|
||
# Instructions | ||
|
||
1. Ensure you have the desired back-end. | ||
|
||
For SpiNNaker see https://spinnakermanchester.github.io/latest/spynnaker.html | ||
|
||
For NEST see http://www.nest-initiative.org/index.php/Software:Download | ||
and to enable full-scale simulation, compile it with MPI support | ||
(use the --with-mpi option when configuring) according to the instructions on | ||
http://www.nest-initiative.org/index.php/Software:Installation | ||
|
||
2. Install PyNN according to the instructions on | ||
http://neuralensemble.org/docs/PyNN/installation.html | ||
|
||
3. Run the simulation by typing ```python run_microcircuit.py <simulator>``` in | ||
your terminal in the folder containing this file, where ```<simulator>``` is one | ||
of ```nest``` or ```spinnaker``` (by default ```spinnaker is selected```). There | ||
are several potential arguments which can be seen by typing | ||
```python run_microcircuit.py <simulator> -h```. A few useful ones include: | ||
|
||
- --sim_duration - The simulation duration in milliseconds (default 1000) | ||
- --output_path - Where output files should be written (default results) | ||
|
||
6. Output files and basic analysis: | ||
|
||
- Spikes are written to .txt files containing IDs of the recorded neurons | ||
and corresponding spike times in ms. | ||
Separate files are written out for each population and virtual process. | ||
File names are formed as 'spikes'+ layer + population + MPI process + .txt | ||
- Voltages are written to .dat files containing GIDs, times in ms, and the | ||
corresponding membrane potentials in mV. File names are formed as | ||
voltmeter label + layer index + population index + spike detector GID + | ||
virtual process + .dat | ||
|
||
- If 'plot_spiking_activity' is set to True, a raster plot and bar plot | ||
of the firing rates are created and saved as 'spiking_activity.png' | ||
|
||
|
||
The simulation was successfully tested with NEST revision 10711 and MPI 1.4.3. | ||
Plotting works with Python 2.6.6 including packages numpy 1.3.0, | ||
matplotlib 0.99.1.1, and glob. | ||
|
||
## Known issues: | ||
|
||
- At least with PyNN 0.7.5 and NEST revision 10711, ConnectWithoutMultapses | ||
works correctly on a single process, but not with multiple MPI processes. | ||
|
||
- When saving connections to file, ensure that pyNN does not create problems | ||
with single or nonexistent connections, for instance by adjusting | ||
lib/python2.6/site-packages/pyNN/nest/__init__.py from line 365 as follows: | ||
|
||
if numpy.size(lines) != 0: | ||
if numpy.shape(numpy.shape(lines))[0] == 1: | ||
lines = numpy.array([lines]) | ||
lines[:,2] *= 0.001 | ||
if compatible_output: | ||
lines[:,0] = self.pre.id_to_index(lines[:,0]) | ||
lines[:,1] = self.post.id_to_index(lines[:,1]) | ||
file.write(lines, {'pre' : self.pre.label, 'post' : self.post.label}) | ||
|
||
- To use saveConnections in parallel simulations, additionally ensure that | ||
pyNN does not cause a race condition where the directory is created by one | ||
process between the if statement and makedirs on another process: In | ||
lib/python2.6/site-packages/pyNN/recording/files.py for instance replace | ||
|
||
os.makedirs(dir) | ||
|
||
by | ||
|
||
try: | ||
os.makedirs(dir) | ||
except OSError, e: | ||
if e.errno != 17: | ||
raise | ||
pass | ||
|
||
Reinstall pyNN after making these adjustments, so that they take effect | ||
in your pyNN installation directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
These tests depend on https://github.com/SpiNNakerManchester/TestBase | ||
|
||
This is not added automatically by setup.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2017-2020 The University of Manchester | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) 2017-2021 The University of Manchester | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from spinnaker_testbase import ScriptChecker | ||
import os | ||
import sys | ||
import stat | ||
|
||
|
||
class TestMicrocircuit(ScriptChecker): | ||
|
||
def test_microcircuit(self): | ||
self.runsafe(self.microcircuit) | ||
|
||
def microcircuit(self): | ||
self.check_script("run_microcircuit.py") | ||
for result_file in [ | ||
"spikes_L23E.pkl", "spikes_L23I.pkl", | ||
"spikes_L4E.pkl", "spikes_L4I.pkl", | ||
"spikes_L5E.pkl", "spikes_L5I.pkl", | ||
"spikes_L6E.pkl", "spikes_L6I.pkl", | ||
"spiking_activity.png"]: | ||
result_path = os.path.join("results", result_file) | ||
assert(os.path.exists(result_path)) | ||
assert(os.stat(result_path)[stat.ST_SIZE]) |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.