Skip to content

Commit

Permalink
Merge pull request LFPy#3 from torbjone/master
Browse files Browse the repository at this point in the history
Bug in example cell model folder structure?
  • Loading branch information
espenhgn committed May 20, 2016
2 parents 471838c + fad2bf2 commit 7222165
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 43 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ The article can be found at http://dx.doi.org/10.3389%2Ffninf.2013.00041
Citation:
Linden H, Hagen E, Leski S, Norheim ES, Pettersen KH and Einevoll GT (2013). LFPy: A tool for biophysical simulation of extracellular potentials generated by detailed model neurons. Front. Neuroinform. 7:41. doi: 10.3389/fninf.2013.00041

LFPy was developed in the Computational Neuroscience Group (http://compneuro.umb.no), Department of Mathemathical Sciences and Technology (http://www.nmbu.no/imt),
at the Norwegian University of Life Sciences (http://www.nmbu.no) ,
LFPy was developed in the Computational Neuroscience Group, Department of Mathemathical Sciences and Technology (http://www.nmbu.no/imt),
at the Norwegian University of Life Sciences (http://www.nmbu.no),
in collaboration with the Laboratory of Neuroinformatics (http://www.nencki.gov.pl/en/laboratory-of-neuroinformatics),
Nencki Institute of Experimental Biology (http://www.nencki.gov.pl), Warsaw, Poland. The effort was supported by
International Neuroinformatics Coordinating Facility (http://incf.org), the Research Council of Norway (http://www.forskningsradet.no/english) (eScience, NevroNor) and EU-FP7 (BrainScaleS, http://www.brainscales.org).
Expand Down Expand Up @@ -82,10 +82,10 @@ There are few options to install LFPy:
cd LFPy-x.x
(sudo) python setup.py install (--user)

4. Development version from subversion repository:
4. Development version from the GitHub repository:
::
svn checkout http://bebiservice.umb.no/svn-public/LFPy-release/trunk LFPy

git clone https://github.com/LFPy/LFPy.git
cd LFPy
(sudo) python setup.py install (--user)

Expand Down
6 changes: 3 additions & 3 deletions examples/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import zipfile
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection

from os.path import join
plt.interactive(1)
plt.close('all')


#Fetch Mainen&Sejnowski 1996 model files
if not os.path.isfile('patdemo/cells/j4a.hoc'):
if not os.path.isfile(join('cells', 'cells', 'j4a.hoc')):
#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')
Expand All @@ -38,7 +38,7 @@

# Define cell parameters
cell_parameters = { # various cell parameters,
'morphology' : 'patdemo/cells/j4a.hoc', # Mainen&Sejnowski, 1996
'morphology' : join('cells', 'cells', 'j4a.hoc'), # Mainen&Sejnowski, 1996
'rm' : 30000., # membrane resistance
'cm' : 1.0, # membrane capacitance
'Ra' : 150, # axial resistance
Expand Down
13 changes: 7 additions & 6 deletions examples/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
'''
LFPs from a population of cells relying on MPI
'''

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection, LineCollection
import os
from os.path import join
import sys
if sys.version < '3':
from urllib2 import urlopen
Expand All @@ -16,7 +18,6 @@
import neuron
from mpi4py import MPI


#initialize the MPI interface
COMM = MPI.COMM_WORLD
SIZE = COMM.Get_size()
Expand All @@ -40,7 +41,7 @@ def stationary_poisson(nsyn,lambd,tstart,tstop):


#Fetch Mainen&Sejnowski 1996 model files
if not os.path.isfile('patdemo/cells/j4a.hoc') and RANK==0:
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')
Expand All @@ -56,7 +57,7 @@ def stationary_poisson(nsyn,lambd,tstart,tstop):

# Define cell parameters
cell_parameters = { # various cell parameters,
'morphology' : 'patdemo/cells/j4a.hoc', # Mainen&Sejnowski, 1996
'morphology' : join('cells', 'cells', 'j4a.hoc'), # Mainen&Sejnowski, 1996
'rm' : 30000., # membrane resistance
'cm' : 1.0, # membrane capacitance
'Ra' : 150, # axial resistance
Expand Down Expand Up @@ -162,7 +163,7 @@ def stationary_poisson(nsyn,lambd,tstart,tstop):
plt.axis('off')

for i_cell in range(n_cells):
cell = LFPy.Cell('patdemo/cells/j4a.hoc',
cell = LFPy.Cell(join('cells', 'cells', 'j4a.hoc'),
nsegs_method='lambda_f',
lambda_f=5)
cell.set_rotation(x=4.99, y=-4.33, z=z_rotation[i_cell])
Expand All @@ -188,8 +189,8 @@ def stationary_poisson(nsyn,lambd,tstart,tstop):
ax.plot(point_electrode.x, point_electrode.z, 'o',
markeredgecolor='none', markerfacecolor='b', markersize=3,
zorder=10, clip_on=False)
plt.annotate("Electrode",\
xy=(0., 0.), xycoords='data',\
plt.annotate("Electrode",
xy=(0., 0.), xycoords='data',
xytext=(-100., 1000.),
arrowprops=dict(arrowstyle='wedge',
shrinkA=1,
Expand Down
7 changes: 4 additions & 3 deletions examples/example5.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#import some plotting stuff and the LFPy-module
import os
from os.path import join
import sys
if sys.version < '3':
from urllib2 import urlopen
Expand All @@ -33,7 +34,7 @@
import matplotlib.pyplot as plt

#Fetch Mainen&Sejnowski 1996 model files
if not os.path.isfile('patdemo/cells/j4a.hoc'):
if not os.path.isfile(join('cells', 'cells', 'j4a.hoc')):
#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')
Expand All @@ -46,11 +47,11 @@

#compile mod files every time, because of incompatibility with Hay2011 files:
os.system('''
cd patdemo
cd cells
nrnivmodl
''')
#os.system('nrnivmodl')
LFPy.cell.neuron.load_mechanisms('patdemo')
LFPy.cell.neuron.load_mechanisms('cells')

################################################################################
# Define parameters, using dictionaries
Expand Down
9 changes: 5 additions & 4 deletions examples/example6.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# importing some modules, including LFPy
import LFPy
import os
from os.path import join
import sys
if sys.version < '3':
from urllib2 import urlopen
Expand All @@ -41,7 +42,7 @@
np.random.seed(1234)

#Fetch Mainen&Sejnowski 1996 model files
if not os.path.isfile('patdemo/cells/j4a.hoc'):
if not os.path.isfile(join('cells', 'cells', 'j4a.hoc')):
#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')
Expand All @@ -54,11 +55,11 @@

#compile mod files every time, because of incompatibility with Hay2011 files:
os.system('''
cd patdemo
cd cells
nrnivmodl
''')
#os.system('nrnivmodl')
LFPy.cell.neuron.load_mechanisms('patdemo')
LFPy.cell.neuron.load_mechanisms('cells')

################################################################################
# A couple of function declarations
Expand Down Expand Up @@ -219,7 +220,7 @@ def insert_synapses(synparams, section, n, spTimesFun, args):

#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
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 7222165

Please sign in to comment.