Python + NetCon = KERN_PROTECTION_FAILURE

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
sec6
Posts: 39
Joined: Sat Mar 15, 2008 10:32 am

Python + NetCon = KERN_PROTECTION_FAILURE

Post by sec6 » Sun Jun 29, 2008 10:12 pm

I'm getting "bus errors" (KERN_PROTECTION_FAILURE) when I try to use NetCons from Python.

Code: Select all

[1] neuron -python
NEURON -- VERSION 6.2.1028 (2151) 2008-06-18
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2007
See http://www.neuron.yale.edu/credits.html

>>> import neuron
>>> h = neuron.h
>>> import nrn
>>> 
>>> h.nrn_load_dll('/Users/foo/bar/myMech/i686/.libs/libnrnmech.so')
loading membrane mechanisms from /Users/foo/bar/myMech/i686/.libs/libnrnmech.so
Additional mechanisms from files
 expSyn1.mod myMechBad.mod myMechGood.mod myMechSimple.mod
1.0
>>> postCell = nrn.Section()
>>> postCell.L = 20
>>> postCell(0.5).diam=20
>>> myMech = nrn.myMechSimple(postCell(0.5))
>>> 
>>> 
>>> preCell0 = nrn.Section()
>>> preCell0.L = 20
>>> preCell0(0.5).diam = 20
>>> preCell0.insert('pas')
<nrn.Section object at 0x7a4060>
>>> preCell0.insert('hh')
<nrn.Section object at 0x7a4060>
>>> 
>>> h.NetCon(preCell0(0.5)._ref_v,myMech)
Bus error
[2] 
I can provide a CrashLog dump if it would be helpful, but it's too bulky to post on the forum.

I suppose I may be doing something wrong, but it still seems like I ought to get an error message rather than crashing NEURON.

I'm using NEURON 6.2.1028 (unthreaded version) built from source, on a MacBook Pro running OSX 10.5.2

Here is the .mod file for the myMechSimple mechanism:

Code: Select all

NEURON {
	POINT_PROCESS myMechSimple
}

NET_RECEIVE	 (w0) {
	printf("w0:\t%g\n",w0)
}
I've also tried this using the ExpSyn1 mechanism, copied from _The NEURON Book_ (just to be sure the problem wasn't with the myMechSimple .mod file) with exactly the same result.

hines
Site Admin
Posts: 1580
Joined: Wed May 18, 2005 3:32 pm

Re: Python + NetCon = KERN_PROTECTION_FAILURE

Post by hines » Mon Jun 30, 2008 2:13 pm

Code: Select all

>>> myMech = nrn.myMechSimple(postCell(0.5))
I'm surprised you were not getting an error here since myMechSimple
is a POINT_PROCESS. The correct idiom is

Code: Select all

myMech = h.ExpSyn(0.5, sec = postCell)
However, I realize that the first statement is in fact a very natural way to
specify the location of the point process, ie. via a compartment, and I will
see if that can be allowed in the future. By the way, also in the future I will
be deprecating the nrn module in favor of doing everything from the h = neuron.HocObject().
See
http://www.neuron.yale.edu/cgi-bin/trac ... /nrn/trunk

Code: Select all

>>> h.NetCon(preCell0(0.5)._ref_v,myMech)
Use

Code: Select all

nc = h.NetCon(preCell0(0.5)._ref_v, myMech, sec = preCell0)
without storing the return value, the new NetCon will be immediately destroyed.
Without the third arg (or an accidentally consistent currently accessed section) you will get
a
nrniv: NetCon pointer not associated with currently accessed section
Use section ... (&var(x)...) intead of ...(&section.var(x)...)
error message.

Note that on my linux machine

Code: Select all

myMech = nrn.ExpSyn(postCell(0.5))
gives the error
AttributeError: 'module' object has no attribute 'ExpSyn'
so I don't know how you were able to get beyond that line.
I will have to try to reproduce this on the mac and if I can, fix the problem
with not producing the correct error messages.

Post Reply