Skip to content

Commit

Permalink
Updated folder structure of downloaded patdemo folder
Browse files Browse the repository at this point in the history
  • Loading branch information
torbjone committed May 20, 2016
1 parent 0e735c6 commit c06f262
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions examples/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@


#Fetch Mainen&Sejnowski 1996 model files
if not os.path.isfile(join('patdemo', 'cells', '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')
localFile.write(u.read())
localFile.close()
#unzip:
myzip = zipfile.ZipFile('patdemo.zip', 'r')
myzip.extractall('patdemo')
myzip.extractall('.')
myzip.close()


Expand All @@ -38,7 +38,7 @@

# Define cell parameters
cell_parameters = { # various cell parameters,
'morphology' : join('patdemo', 'cells', '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

0 comments on commit c06f262

Please sign in to comment.