Record the sum of multiple sources with h.Vector()
Posted: Mon Oct 19, 2015 10:35 pm
I am trying to create a parallel model that takes advantage of the extracellular recording mechanisms in viewtopic.php?f=28&t=168.
This model does the integration in the run control of each timestep. From what I understand, this won't work in parallel simulations.
I am trying to instead use vectors. I am currently using the following method:
I create a vector for each segment of each section of each cell that records er_xtra, and then sum them all together at the end of the simulation. This works, but is obviously memory inefficient.
What I'm wondering is if theres a way to set a single vector to record the sum of multiple sources. Something like this:
This doesn't work. Is there a way to make this work? I've tried replacing line 132 with but that also doesn't work because the arrays are empty when they are initialized.
This model does the integration in the run control of each timestep. From what I understand, this won't work in parallel simulations.
I am trying to instead use vectors. I am currently using the following method:
I create a vector for each segment of each section of each cell that records er_xtra, and then sum them all together at the end of the simulation. This works, but is obviously memory inefficient.
Code: Select all
114│ def _set_rec_vectors(self):
115│ self.rec_vectors = []
116│ for cell in self.cells:
117│ for sec in cell.all:
118│ if h.ismembrane('xtra'):
119│ for i in np.arange(sec.nseg+2)[1:-1]/float(sec.nseg+1):
120│ vec = h.Vector()
121│ vec.record(sec(i)._ref_er_xtra)
122│ self.rec_vectors.append(vec)
Code: Select all
124│ def _set_v_rec(self):
125│ self.v_rec = h.Vector()
126│ for cell in self.cells:
127│ for sec in cell.all:
128│ if h.ismembrane('xtra'):
129│ for i in np.arange(sec.nseg+2)[1:-1]/float(sec.nseg+1):
130│ temp = h.Vector()
131│ temp.record(sec(i)._ref_er_xtra)
132│ self.v_rec += temp
Code: Select all
self.v_rec = self.v_rec.add(temp)