Skip to content

Commit

Permalink
Merge pull request #19 from OpenSourceBrain/test_pynn3
Browse files Browse the repository at this point in the history
Latest PyNN version updated to be tested with latest libraries
  • Loading branch information
pgleeson authored Apr 2, 2024
2 parents cb7979b + 483e152 commit 6150525
Show file tree
Hide file tree
Showing 21 changed files with 1,285 additions and 1,002 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/omv-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:


steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ NEST_SLI/*.gdf
/PyNN/*.mod
/PyNN/*.net.nml
/PyNN/tests.log
/PyNN/data/2024*
/p0/*
16 changes: 8 additions & 8 deletions PyNN/.test.pynn.mep
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ experiments:

spike_rate_l23e:
expected:
spike rate: 1.6693811074918568 # Note: this reflects only rate of cells that spiked at least once...
spike rate: 1.4385775862068966 # Note: this reflects only rate of cells that spiked at least once...
spike_rate_l23i:
expected:
spike rate: 3.643617021276596
spike rate: 3.44954128440367
spike_rate_l4e:
expected:
spike rate: 4.9837255883825735
spike rate: 4.850835322195704
spike_rate_l4i:
expected:
spike rate: 7.290489642184557
spike rate: 7.12312734082397
spike_rate_l5e:
expected:
spike rate: 7.753623188405797
spike rate: 7.869022869022869
spike_rate_l5i:
expected:
spike rate: 8.016826923076923
spike rate: 7.85377358490566
spike_rate_l6e:
expected:
spike rate: 2.094361334867664
spike rate: 1.8208245243128964
spike_rate_l6i:
expected:
spike rate: 8.274828767123287
spike rate: 8.225255972696246
2 changes: 1 addition & 1 deletion PyNN/.test.pynnnest.comparison.omt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation

target: microcircuit.py
target: test.py
engine: PyNN_Nest
mep: ../PyNEST/.test.pynest.mep
experiments:
Expand Down
2 changes: 1 addition & 1 deletion PyNN/.test.pynnnest.omt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation

target: microcircuit.py
target: test.py
engine: PyNN_Nest
mep: .test.pynn.mep
experiments:
Expand Down
95 changes: 0 additions & 95 deletions PyNN/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions PyNN/connectivity.py

This file was deleted.

49 changes: 49 additions & 0 deletions PyNN/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
"""
PyNN microcircuit example
---------------------------
Example file to run the microcircuit.
Based on original PyNEST version by Hendrik Rothe, Hannah Bos, Sacha van Albada; May 2016
Adapted for PyNN by Andrew Davison, December 2017
"""

import time
import numpy as np
import network
from network_params import net_dict
from sim_params import sim_dict
from stimulus_params import stim_dict


# Initialize the network and pass parameters to it.
tic = time.time()
net = network.Network(sim_dict, net_dict, stim_dict)
toc = time.time() - tic
print("Time to initialize the network: %.2f s" % toc)
# Connect all nodes.
tic = time.time()
net.setup()
toc = time.time() - tic
print("Time to create the connections: %.2f s" % toc)
# Simulate.
tic = time.time()
net.simulate()
toc = time.time() - tic
print("Time to simulate: %.2f s" % toc)
tic = time.time()
net.write_data()
toc = time.time() - tic
print("Time to write data: %.2f s" % toc)
# Plot a raster plot of the spikes of the simulated neurons and the average
# spike rate of all populations. For visual purposes only spikes 100 ms
# before and 100 ms after the thalamic stimulus time are plotted here by
# default. The computation of spike rates discards the first 500 ms of
# the simulation to exclude initialization artifacts.
raster_plot_time_idx = np.array(
[stim_dict['th_start'] - 100.0, stim_dict['th_start'] + 100.0]
)
fire_rate_time_idx = np.array([500.0, sim_dict['t_sim']])
net.evaluate(raster_plot_time_idx, fire_rate_time_idx)
Loading

0 comments on commit 6150525

Please sign in to comment.