Method for moving IClamp

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
Nin
Posts: 41
Joined: Thu May 03, 2007 4:04 pm
Location: Institute of Science and Technology (IST Austria)
Contact:

Method for moving IClamp

Post 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.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Method for moving IClamp

Post by ted »

Easily done with hoc--see
Point processes: loc() and get_loc()
viewtopic.php?f=28&t=1057
mctavish
Posts: 74
Joined: Tue Mar 14, 2006 6:10 pm
Location: New Haven, CT

Re: Method for moving IClamp

Post 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

Code: Select all

stim.loc(sec(x))
Nin
Posts: 41
Joined: Thu May 03, 2007 4:04 pm
Location: Institute of Science and Technology (IST Austria)
Contact:

Re: Method for moving IClamp

Post by Nin »

This was exactly what I was looking for! Thanks a lot!!!!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Method for moving IClamp

Post 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.
Nin
Posts: 41
Joined: Thu May 03, 2007 4:04 pm
Location: Institute of Science and Technology (IST Austria)
Contact:

Re: Method for moving IClamp

Post 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!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Method for moving IClamp

Post by ted »

Great, now we all have learned something new.
Post Reply