Skip to content

Instantly share code, notes, and snippets.

@apdavison
apdavison / demo.py
Created September 7, 2017 13:56
Demonstration of parallel writing to file using h5py and mpi4py
"""
Creates an HDF5 file with a single dataset of shape (channels, n),
filled with random numbers.
Writing to the different channels (rows) is parallelized using MPI.
Usage:
mpirun -np 8 python demo.py
Small shell script to run timings with different numbers of MPI processes:
@apdavison
apdavison / sumatra_example_update_record.py
Created September 1, 2015 12:49
An example of updating a Sumatra record
from __future__ import unicode_literals
import numpy
import sys
import time
from sumatra.projects import load_project
from sumatra.parameters import build_parameters
def main(parameters):
numpy.random.seed(parameters["seed"])
distr = getattr(numpy.random, parameters["distr"])
@apdavison
apdavison / gist:2762961
Created May 21, 2012 15:40
Some ideas for syntax for multicompartmental modelling in PyNN
"""
Some ideas for syntax for multicompartmental modelling in PyNN
Andrew Davison, May 2012
"""
# Example 1
import pyNN.neuron as sim
from neuroml import load_morphology, load_lems, Section
from pyramidal.spatial_distributions import uniform, by_distance