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 » Mon Mar 07, 2011 9:51 am

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: 5591
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Method for moving IClamp

Post by ted » Mon Mar 07, 2011 4:41 pm

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 » Tue Mar 08, 2011 9:20 am

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 » Wed Mar 09, 2011 4:18 am

This was exactly what I was looking for! Thanks a lot!!!!

ted
Site Admin
Posts: 5591
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Method for moving IClamp

Post by ted » Wed Mar 09, 2011 10:17 am

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 » Wed Mar 09, 2011 1:12 pm

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: 5591
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Method for moving IClamp

Post by ted » Thu Mar 10, 2011 9:14 am

Great, now we all have learned something new.

Post Reply