Page 1 of 1
Method for moving IClamp
Posted: Mon Mar 07, 2011 9:51 am
by Nin
I was wondering if is there any method to change easily the location of a point process (like IClamp) without having to create and delete an h.IClamp object in Python everytime we change the section. I am trying to simulate THE SAME current injection in different sections of a cell.
Code: Select all
def stimulator(sec)
stim = h.IClamp(0.5, sec)
stim.dur = 2.5
stim.amp = 4.0
stim.delay = .1
return stim
# TODO: implement stimulator.move(new_location) with a class Stimulator
for sec in section_list:
mystim = stimulator(sec)
# run the simulation and obtain vectors
del mystim
in the last loop, if I do not delete the h.IClamp object, the stimulators accumulate.
Re: Method for moving IClamp
Posted: Mon Mar 07, 2011 4:41 pm
by ted
Easily done with hoc--see
Point processes: loc() and get_loc()
viewtopic.php?f=28&t=1057
Re: Method for moving IClamp
Posted: Tue Mar 08, 2011 9:20 am
by mctavish
Simply using loc() uses the currently accessed section and not the section that the element was placed on. You can do this more explicitly as
Re: Method for moving IClamp
Posted: Wed Mar 09, 2011 4:18 am
by Nin
This was exactly what I was looking for! Thanks a lot!!!!
Re: Method for moving IClamp
Posted: Wed Mar 09, 2011 10:17 am
by ted
You should probably test to see whether
stim.loc(sec(x))
changes the currently accessed section from { whatever it was previously } to { sec }. Check to see if
h.cas()
returns the same result when executed before and after executing stim.loc(sec(x))
This would be a good time to review the relevant Programmer's Reference entries on Python, specifically regarding cas and Section.
Re: Method for moving IClamp
Posted: Wed Mar 09, 2011 1:12 pm
by Nin
ted wrote:You should probably test to see whether
stim.loc(sec(x))
changes the currently accessed section from { whatever it was previously } to { sec }.
No, it does not change the currently accessed section:
In my case
Code: Select all
>>> mycell.soma.push()
>>> h.cas().name()
>>> '<CA3neuron.Neuron object at 0xb04220c>.soma'
Now I stimulate somewhere else with the same parameters
Code: Select all
>>> stim.loc(0.5, sec=mycell.dend[110])
But the currently accessed section remains the same (and it remains after h.run() too).
Code: Select all
>>> h.cas().name()
>>> '<CA3neuron.Neuron object at 0xb04220c>.soma'
Thanks a lot for your help!
Re: Method for moving IClamp
Posted: Thu Mar 10, 2011 9:14 am
by ted
Great, now we all have learned something new.