I am trying to call python function in a class using hoc statements to redefine init block. It was pretty easy using hoc programming, but to do the same, in python, I used this approach.
I have a MPI based network and in the prun block, I define
Code: Select all
def prun(self):
if self.rank==0:
print 'In the function SIMULATING CELLS...\n'
self.pc.set_maxstep(10)
#h('proc init() {nrnpython("prepruninitialize()")}') - this didn't work either
h('''objref po
po=new PythonObject()
proc init(){
finitialize(-65)
po.prepruninitialize()
finitialize()
if (cvode_active()){
cvode.re_init()
}else{
fcurrent()
}
frecord_init()
}
''')
h.stdinit()
def prepruninitialize(self):
if self.rank==0:
print 'Setting up initial conditions...\n'
for ii in range(len(self.grcells)):
self.grcells[ii].setv() # setting up initial voltage.
What am I doing wrong here? Can you kindly let me know?
Thank you.