Search found 74 matches

by mctavish
Thu Apr 19, 2012 1:49 pm
Forum: NEURON + Python
Topic: Section creation
Replies: 2
Views: 1930

Re: Section creation

A general idiom for Python cell objects is: from neuron import h class Cell(object): def __init__(self): self.soma = h.Section(name='soma', cell=self) The "cell=self" tells NEURON what Python object this section belongs to. To be honest, I'm not sure if it is really required or poses a problem if yo...
by mctavish
Thu Apr 05, 2012 12:58 pm
Forum: Parallel NEURON
Topic: Splitbit value assignment
Replies: 2
Views: 2379

Re: Splitbit value assignment

Thanks for the interest in our model. Basically, our mitral cell is split into three parts: 1) the central Tuft, primary dendrite, soma and axon, 2) left dendrite, 3) right dendrite. Each part must have a unique GID. This is our hashing function to map these sections to GIDs. We could have made a sc...
by mctavish
Thu May 12, 2011 11:09 am
Forum: OS X
Topic: command not found
Replies: 10
Views: 9616

Re: command not found

You can download Xcode 3.2.6 for free at http://developer.apple.com/devcenter/mac/index.action. Following the Apple's nickel-and-diming way of getting rich, Xcode 4 requires a free developer registration followed by a $5 download from the App Store.
by mctavish
Wed Apr 20, 2011 10:33 am
Forum: OS X
Topic: installation of NEURON on snow leopard 64 bits
Replies: 1
Views: 1963

Re: installation of NEURON on snow leopard 64 bits

You might try this recipe:

viewtopic.php?f=2&t=2191

It uses the Enthought Distribution of Python, which includes scipy....
by mctavish
Fri Mar 25, 2011 4:00 pm
Forum: NEURON + Python
Topic: FInitializeHandler example in Python
Replies: 1
Views: 1894

FInitializeHandler example in Python

I rewrote the FInitializerHandler example from the hoc reference for python. I had gotten hung up on trying to pass the function as a string to FInitializerHandler(). Turns out you pass the reference.... from neuron import h as nrn nrn.load_file("nrngui.hoc") def fi0(): global a print "fi0() called ...
by mctavish
Tue Mar 08, 2011 9:20 am
Forum: NEURON + Python
Topic: Method for moving IClamp
Replies: 6
Views: 3710

Re: Method for moving IClamp

Simply using loc() uses the currently accessed section and not the section that the element was placed on. You can do this more explicitly as

Code: Select all

stim.loc(sec(x))
by mctavish
Tue Feb 01, 2011 11:13 am
Forum: NEURON + Python
Topic: Neuron with Enthought Python on Snow Leopard
Replies: 0
Views: 3152

Neuron with Enthought Python on Snow Leopard

I have been working with installing NEURON under Enthought Python Distributions. Here is a general recipe for a 32-bit compile: IDIR=${HOME}/neuron IVDIR=iv_epd32 NRNDIR=nrn_epd32 hg clone http://www.neuron.yale.edu/hg/neuron/iv $IVDIR hg clone http://www.neuron.yale.edu/hg/neuron/nrn $NRNDIR cd $IV...
by mctavish
Fri Jan 07, 2011 3:28 pm
Forum: NEURON + Python
Topic: Parallel Neuron: NetCon failed to connect different hosts
Replies: 4
Views: 3005

Re: Parallel Neuron: NetCon failed to connect different hosts

Nice use of Sage, Jose! A couple of notes: The Sage worksheet is a bit problematic since the permissions do not allow you to write to the "data" folder from the mpiexec call. Even though the simulation.py file is in the data folder and you can typically write new files there in python with Sage scri...
by mctavish
Fri Dec 03, 2010 9:50 am
Forum: NEURON + Python
Topic: inserting point process
Replies: 1
Views: 1388

Re: inserting point process

Pre is still the currently accessed section.

Try:

Code: Select all

from neuron import h
ampa=h.gluR(post(0.5))
h.psection(sec=post)
by mctavish
Thu Dec 02, 2010 4:23 pm
Forum: NEURON + Python
Topic: diam(0:1) = A:B in Python
Replies: 8
Views: 3314

Re: diam(0:1) = A:B in Python

Good eye, Ted! I was coding what I thought Mike wanted. Here is a hoc equivalent, which is quite comparable to what he wrote before: import numpy from neuron import h as nrn from itertools import izip def taper_diam(sec,zero_bound,one_bound): dx = 1./sec.nseg for (seg, x) in izip(sec, numpy.arange(d...
by mctavish
Thu Dec 02, 2010 2:19 pm
Forum: NEURON + Python
Topic: diam(0:1) = A:B in Python
Replies: 8
Views: 3314

Re: diam(0:1) = A:B in Python

This type of linear mapping can be easily handled with numpy's linspace. import numpy from neuron import h as nrn from itertools import izip def taper_diam(sec,zero_bound,one_bound): for (seg, d) in izip(sec, numpy.linspace(zero_bound, one_bound, sec.nseg)): seg.diam=d # Test dend = nrn.Section(name...
by mctavish
Wed Dec 01, 2010 3:13 pm
Forum: NEURON + Python
Topic: More NEURON + Python resources
Replies: 4
Views: 15455

More NEURON + Python resources

Here is a list of Python resources with NEURON. Our Sage server equipped with NEURON is a nice resource for example code and recipes. It is a place to try NEURON and Python without installing either on your local machine. To use, visit https://nn.med.yale.edu:8000 and log in with a user id and passw...
by mctavish
Wed Dec 01, 2010 2:34 pm
Forum: NEURON + Python
Topic: NEURON + Python SfN Tutorial Links
Replies: 0
Views: 1682

NEURON + Python SfN Tutorial Links

Below is a summary from the NEURON + Python tutorial at SfN. Unfortunately, attachments are not part of the bulletin board, so email me if you are interested in any of the slides. The seminar had two parts: low-level python code delivered by Tom McTavish and higher-level presentations by the other s...
by mctavish
Tue Nov 09, 2010 3:24 pm
Forum: NEURON + Python
Topic: NEURON + Python hands-on tutorial, San Diego 2010
Replies: 3
Views: 4465

Re: NEURON + Python hands-on tutorial, San Diego 2010

The response to this seminar has been overwhelming and there are more people on the wait list than there are seats available. We will be placing the seminar materials on the NEURON forum after SfN. Additionally, I have two posters at SfN -- one educational poster Saturday and Sunday (#OOO43), which ...
by mctavish
Fri Oct 29, 2010 3:18 pm
Forum: NEURON + Python
Topic: access the section after loading a morphology file
Replies: 6
Views: 3236

Re: access the section after loading a morphology file

the "for sec in h.allsec():" does the trick. Here is a loop that will make a list of tuples containing 3D points, the diameter, and the section name. points3d = [] for sec in h.allsec(): num_points = int(h.n3d()) # Get the number of 3D points in the section for i in range(num_points): x = h.x3d(i) y...