Skip to content

Commit

Permalink
Corrected folder structure, and running nrnivmold every time
Browse files Browse the repository at this point in the history
  • Loading branch information
torbjone committed May 20, 2016
1 parent c06f262 commit fad2bf2
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions examples/example_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
# The example uses mpi4py with openmpi, and do not rely on NEURON's MPI.
################################################################################
'''

import os
from os.path import join
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
Expand All @@ -27,31 +29,30 @@
RANK = COMM.Get_rank()

#Fetch Mainen&Sejnowski 1996 model files
if not os.path.isfile('patdemo/cells/j4a.hoc'):
if RANK == 0:
#get the model files:
u = urlopen('http://senselab.med.yale.edu/ModelDB/eavBinDown.asp?o=2488&a=23&mime=application/zip')
localFile = open('patdemo.zip', 'w')
localFile.write(u.read())
localFile.close()
#unzip:
myzip = zipfile.ZipFile('patdemo.zip', 'r')
myzip.extractall('.')
myzip.close()
if not os.path.isfile(join('cells', 'cells', 'j4a.hoc')) and RANK == 0:

#get the model files:
u = urlopen('http://senselab.med.yale.edu/ModelDB/eavBinDown.asp?o=2488&a=23&mime=application/zip')
localFile = open('patdemo.zip', 'w')
localFile.write(u.read())
localFile.close()
#unzip:
myzip = zipfile.ZipFile('patdemo.zip', 'r')
myzip.extractall('.')
myzip.close()

if RANK == 0:
#compile mod files
os.system('''
cd cells
nrnivmodl
''')

#compile mod files
os.system('''
cd patdemo
nrnivmodl
''')
else:
pass

#sync threads
COMM.Barrier()
COMM.Barrier()

#os.system('nrnivmodl')
LFPy.cell.neuron.load_mechanisms('patdemo')
LFPy.cell.neuron.load_mechanisms('cells')

#set one global seed, ensure all randomizations are set on RANK 0 in script!
np.random.seed(12345)
Expand Down Expand Up @@ -252,7 +253,7 @@ def plotstuff(self):
########### PARAMETERS ##################
#define cell parameters used as input to cell-class
cellParameters = {
'morphology' : 'morphologies/L5_Mainen96_wAxon_LFPy.hoc',
'morphology' : join('morphologies', 'L5_Mainen96_wAxon_LFPy.hoc'),
'rm' : 30000, # membrane resistance
'cm' : 1.0, # membrane capacitance
'Ra' : 150, # axial resistance
Expand Down

0 comments on commit fad2bf2

Please sign in to comment.