Saving vector at each time step - not associated with cell

General issues of interest both for network and
individual cell parallelization.

Moderator: hines

sgratiy
Posts: 41
Joined: Tue Mar 30, 2010 5:33 pm

Re: Saving vector at each time step - not associated with ce

Post by sgratiy » Thu May 22, 2014 2:20 pm

I prefer to modify the proc advance() rather than using pybs.mod. Now I get the idea for accesing Python object from inside the hoc. However the code:

Code: Select all

h('''
objref po
po = new PythonObject()
proc advance() {
  fadvance()
  po.mypopulation.calc_csd()
}
does not seem to work because during the execution I get the prompt in the terminal window when the interpreter enters the proc advance():

Code: Select all

>	oc>
and the code stops execution. It does not report error, but simply offers the HOC prompt.

Also, if I may use the following commands for the simulation control:

Code: Select all

{pc.set_maxstep(10)}
h.stdinit()
{pc.psolve(h.tstop)}
then how does the proc advance() gets called since it is not a part of stinit() or psolve()?
Is W a 1-d numpy array?
W is a 2-d numpy array so dot(self.W,self.i_mem_seg) is a 1-d array .
But I'm doing nothing with the return value so it is being lost.
Would it still be lost if I append the csd vector to the self.csdVecList in the mypopulation object? This append should happen on every time step:

Code: Select all

    
    def calc_csd(self):
        
        for sec in self.cell[0].dendritic:  # for now use only a single cell for CSD calculations
            for jseg,seg in enumerate(sec):    
                self.i_mem_seg[jseg] = seg.i_membrane*h.area(seg.x) # get membrane current for the segment
               
        self.csdVecList.append(dot(self.W,self.i_mem_seg)) #  append csdvec(t) to a list of CSD vectors 

        
Thanks.

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

Re: Saving vector at each time step - not associated with ce

Post by hines » Thu May 22, 2014 2:47 pm

does not seem to work...
Prior to http://www.neuron.yale.edu/hg/neuron/nr ... 9cbf2ab715 1047:3e9cbf2ab715 Release 7.3 16 Mar 2014
function definitiions had to be on a single line. e.g

Code: Select all

h('''
objref po
po = new PythonObject()
proc advance() {  fadvance()  po.mypopulation.calc_csd() }
''')
that limitation was removed beginning at the above changeset.

If you use pc.psolve() then you must also use pybs.mod because pc.psolve does not call proc advance. That only happens if you use
the stdrun.hoc version of
proc run
proc continuerun
proc steprun
proc advance
fadvance
Would it still be lost if I append the csd vector to the self.csdVecList in the mypopulation object?
No.

Post Reply