Page 1 of 1

pointprocess does not know its own type/name

Posted: Tue Aug 25, 2009 2:16 pm
by eacheon
Using

Code: Select all

 p = neuron.new_point_process('ExpSyn') 
I can get the name of p by access name attribute. But since neuron.new_point_process is becoming obsolete, from the correspondent usage

Code: Select all

a = h.ExpSyn(0.5, sec = dend))
nc = h.NetCon(stim, a)
I cannot get the name (or type) of a (as an ExpSyn):

Code: Select all

>> a.__str__()
>> '<hoc.HocObject object at 0x892bef8>'

>> a.__repr__()
>> '<hoc.HocObject object at 0x892bef8>'

Strangely, "print a" gives

Code: Select all

>> print a
ExpSyn[3]
But redirect stdio doesn't work (doesn't give me a str 'ExpSyn[3]'), could HocObject, especially PointProcess object has an attribute that stores its own type/name?

Re: pointprocess does not know its own type/name

Posted: Tue Aug 25, 2009 8:19 pm
by hines
you can work around the problem with

Code: Select all

s = h.ref('')
h.sprint(s, '%s', a)
print s[0]
you can put the idiom in a
def hocObjectName(hocobject):
and return a tuple of (classname, index) if you find that useful

Re: pointprocess does not know its own type/name

Posted: Sat Aug 29, 2009 4:27 pm
by hines
See viewtopic.php?f=2&t=1759
In the future, one would find the type information for a HocObject instance with
a.hname()