is possible to use isinstance() with Segment objects?
Posted: Sun Dec 12, 2010 10:57 am
Hi everybody,
for debugging processes, I would like to test if an object passed as argument to a class is indeed a Segment. I though that checking it with isinstance() would be appropriate, but unfortunately this launches an error:
here a minimal example:
Before doing:
I would like to test if soma_seg[1] is a Segment...
but
gives me
AttributeError: 'hoc.HocObject' object has no attribute 'Segment'
Am I doing something wrong?
Thanks a lot in advance
for debugging processes, I would like to test if an object passed as argument to a class is indeed a Segment. I though that checking it with isinstance() would be appropriate, but unfortunately this launches an error:
here a minimal example:
Code: Select all
from neuron import h
soma = h.Section(name = 'soma')
soma.nseg = 3
# a list of segments
soma_seg = [seg for seg in soma]Code: Select all
stim = IClamp(soma_seg[1])but
Code: Select all
isinstance(soma_seg[1], h.Segment)AttributeError: 'hoc.HocObject' object has no attribute 'Segment'
Am I doing something wrong?
Thanks a lot in advance