- Is there a way to call a Python method from inside a Hoc proc?
If I modify advance() as described below, will I slow down execution horribly?
Is there some other better, or more conventional way than the one described below to accumulate output on disk, rather than in memory?
The reason I want to do this is:
I'm recording spike times into hoc.Vectors using the Netcon.record() method
The simulation is very long (millions of milliseconds), and the Vectors are occupying more memory than I've got (4 gig, of which about 0.5 gig is used by the OS, and the rest is available to NEURON).
So, instead of keeping it all in physical RAM, I want to write it to disk, and use the Vectors like file buffers.
I figure I can accomplish this by overwriting advance() with something like:
Code: Select all
proc advance() {
if (my_nrnSsn_instance.largestVecLen() > blockLen) {
my_nrnSsn_instance.appendVectorsToFile()
my_nrnSsn_instance.initVectors()
}
fadvance()
}
Code: Select all
Class nrnSsn:
...
def largestVecLen():
return(max([v.size() for v in self.vecList]))
def initVectors():
for (nc,vec) in zip(self.netconList,self.vecList):
nc.record(vec)
def appendVectorToFile():
pass #Left as an exercise to the reader ;}
Why, you may ask, do I not write largestVecLen(), initVectors(), and appendVectorToFile in Hoc?
Well, apart from the fact that I find Hoc a lot harder to use than Python, my_nrnSsn_instance.vecList and my_nrnSsn_instance.netconList are *Python* lists of *Hoc* objects. I don't see how I'd get a largestVecLen or initVectors proc written in Hoc to iterate over a Python list.