Search found 22 matches

by lcampagn
Mon Apr 20, 2015 8:47 pm
Forum: NEURON + Python
Topic: Can't delete point process after accessing range variable
Replies: 2
Views: 1276

Re: Can't delete point process after accessing range variabl

I'm sorry, this is just a duplicate of my previous report: viewtopic.php?f=2&t=3221
by lcampagn
Mon Apr 20, 2015 3:02 pm
Forum: NEURON + Python
Topic: Can't delete point process after accessing range variable
Replies: 2
Views: 1276

Can't delete point process after accessing range variable

Greetings, I have a problem where point processes are not being removed from NEURON (7.3) even though all python references are apparently lost. Here is my simple point process: NEURON { POINT_PROCESS TestPointProc RANGE rangeval } ASSIGNED { rangeval (1) } ..and a script that demonstrates the probl...
by lcampagn
Sun Nov 09, 2014 7:12 pm
Forum: NEURON + Python
Topic: Reference leak when using PointProcess.get_segment()
Replies: 1
Views: 1301

Reference leak when using PointProcess.get_segment()

This is an issue I ran into while debugging unit tests in pynrn: from neuron import h s = h.Section() c = h.IClamp(0.5, s) g = c.get_segment() del s del c del g print "Sections:", len(list(h.allsec())) print "IClamps: ", len(list(h.List('IClamp'))) The output looks like: Sections: 1 IClamps: 1 It lo...
by lcampagn
Fri Nov 07, 2014 3:27 pm
Forum: Other questions
Topic: Inconsistent results with MechanismStandard
Replies: 0
Views: 1177

Inconsistent results with MechanismStandard

I am trying to understand how to use MechanismStandard, but it is returning inconsistent results in some situations. For example: from neuron import h #s = h.Section() #s.insert('hh') ms = h.MechanismStandard('k_ion', 1) print ms.count() As written, the output is 3. If I uncomment the line that crea...
by lcampagn
Thu Nov 06, 2014 8:22 pm
Forum: NEURON + Python
Topic: Running multiple simulations in one process
Replies: 19
Views: 8842

Re: Running multiple simulations in one process

The behavior you describe is a property of Python not of NEURON. That's exactly my point. You and I are aware of sys.last_traceback, but the vast majority of NEURON users are not (and even I would have to do a lot of digging to fix this issue). As I have said, there are many different ways referenc...
by lcampagn
Thu Nov 06, 2014 3:49 pm
Forum: NEURON + Python
Topic: Running multiple simulations in one process
Replies: 19
Views: 8842

Re: Running multiple simulations in one process

Thanks again, Michael! I'd like to return to this issue of object deletion, because there seems to be some doubt about my concern that reference management in python is hard. Let's take the following example: from neuron import h sections = {} def make_sec(name): sec = h.Section(name=name) if name i...
by lcampagn
Mon Nov 03, 2014 12:31 pm
Forum: NEURON + Python
Topic: A pythonic API for NEURON
Replies: 2
Views: 1636

Re: A pythonic API for NEURON

Thanks Michael, I want to clarify that I am working on a wraper around the existing NEURON+Python; my suggestion to use ctypes is a separate issue. The focus of this is to see whether I can build an API that is a bit more natural to use in python. I only intend to have partial backward compatibility...
by lcampagn
Wed Oct 29, 2014 8:50 pm
Forum: NEURON + Python
Topic: Running multiple simulations in one process
Replies: 19
Views: 8842

Re: Running multiple simulations in one process

. . . have everything else work with a weakref proxy object. Unfortunately, weakrefs are not allowed to most (all?) neuron objects. I'd think you'd be reset if you reset globals, removed all sections (check h.allsec), all point processes (get a list of possible types with h.MechanismType and of ins...
by lcampagn
Tue Oct 28, 2014 6:13 pm
Forum: NEURON + Python
Topic: Running multiple simulations in one process
Replies: 19
Views: 8842

Re: Running multiple simulations in one process

Is the issue that you have no control over the code that is being run? We are writing a general-purpose model that we hope will be useful to a larger community. So in that sense we have complete control over the code within the model, but we do no control the ways it will be used (except by writing...
by lcampagn
Tue Oct 28, 2014 5:28 pm
Forum: NEURON + Python
Topic: Running multiple simulations in one process
Replies: 19
Views: 8842

Re: Running multiple simulations in one process

This is a big deal when using NEURON from Python? It has been a big deal for me, but perhaps I have some basic misunderstanding of how the API works. The problem is that there is no way to explicitly remove objects from the NEURON kernel; instead this is done indirectly when Python collects the obj...
by lcampagn
Tue Oct 28, 2014 2:17 pm
Forum: NEURON + Python
Topic: Running multiple simulations in one process
Replies: 19
Views: 8842

Running multiple simulations in one process

I am looking for a comprehensive set of guidelines on how to correctly run two different simulations (serially) within the same process (or alternatively, whether this is even supported behavior in the first place). Ideally, the results of the second simulation should be in no way affected by any de...
by lcampagn
Tue Oct 28, 2014 1:44 pm
Forum: NEURON + Python
Topic: A pythonic API for NEURON
Replies: 2
Views: 1636

A pythonic API for NEURON

I have been working with Python + NEURON lately and found myself frustrated with the API on several occasions. Some of the problems are related to the original translation from HOC to Python, some are historical API issues inherited from early versions of the Python interface, and some appear to be ...
by lcampagn
Fri Oct 24, 2014 11:17 am
Forum: NEURON + Python
Topic: Confused about accessing segments in Python
Replies: 2
Views: 1486

Re: Confused about accessing segments in Python

Thanks, Michael!
by lcampagn
Thu Oct 23, 2014 3:09 pm
Forum: NEURON + Python
Topic: Confused about accessing segments in Python
Replies: 2
Views: 1486

Confused about accessing segments in Python

Take the following session example: >>> s = h.Section() >>> s.nseg 1 >>> s.allseg() <nrn.Section object at 0x7f50c483fd50> >>> list(s) [<nrn.Segment object at 0x7f50bc8ab058>, <nrn.Segment object at 0x7f50bc8ab8c8>, <nrn.Segment object at 0x7f50bc8ab7d8>] >>> list(s.allseg()) [<nrn.Segment object at...
by lcampagn
Thu Oct 23, 2014 2:43 pm
Forum: NEURON + Python
Topic: Minor bug: uncaught python error condition
Replies: 1
Views: 1132

Minor bug: uncaught python error condition

Example:

Code: Select all

>>> h.same(1, 2)
False
>>> h.fadvance()
TypeError: function takes exactly 1 argument (2 given)
It appears the first statement generated a python error, but the exception was not raised until the error check in the following statement.