Page 1 of 1

Interviews graphing in Python

Posted: Thu Sep 29, 2016 11:29 pm
by JBall

I'm getting back into Neuron after a few years' hiatus...this time teaching myself Python in the process. I'm generally picking things up well, but I'm banging my head against graphing variables using the IV interface from python. I apologize--I wouldn't have created a forum topic if I'd had any luck looking for examples that address my problem.

My current test model is a small intfire network. I do think this could be part of my problem (one example--I've noticed that I get an error using h.Vector.record(h._ref_t) if I have only created ARTIFICIAL_CELL objects with no proper Sections to be found). However, I don't think it explains everything that I'm seeing.

So, in my hoc template called intfire, I create a public objref called "s" and assign it to a new IntFire1 object. I created an array of these templates (objref cell[4]). I then graph the intfire object state in IV by creating a new state graph, right-clicking-> "plot what", and entering cell[0].s.m. In hoc, it works just fine and all is well.

In python, I'm doing everything basically the same except for the pythonish invocation of the model (which seems to be OK), but the terminal complains when I try to plot the same variable, claiming that "cell" is not an array object. I also get complaints along the lines of "oc_restore_code tobj_count = X when it should be X-1". I tried the same thing from the terminal:

g = h.Graph()

But still an error. I also tried assigning "x = cell[0].s._ref_m", but plotting x doesn't work. However, that syntax does work with h.Vector.record(). I gather I'm missing something guess is that I'm asking IV functions to handle Python variables, which it finds unsatisfactory. Am I stuck using matplotlib for graphing? I gather I should learn it eventually, but IV is very convenient for quick model design & debugging.

Thanks in advance,

Re: Interviews graphing in Python

Posted: Fri Sep 30, 2016 3:27 pm
by ted
First a comment: the typical practice is to capture spike times to vectors, especially with artificial spiking cells, but also with networks of biophysical model cells (especially for large nets or long simulations).

To advise you about the particular problem you have encountered, additional information is necessary.
What operating system are you using, and what versions of NEURON and Python?
Also, it will be necessary to reproduce the problem, so can you please zip up just the hoc, mod, ses, and py files that are needed to see the problem, and email them to me
ted dot carnevale at yale dot edu
along with specific instructions about how to launch your code and whether it is necessary to execute any specific commands to elicit the symptoms?