apply extracellular electric field and current

Anything that doesn't fit elsewhere.
Post Reply
firoozeh
Posts: 7
Joined: Mon Mar 09, 2020 8:40 am

apply extracellular electric field and current

Post by firoozeh »

Hello

I am new NEURON user and I apologize you for my elementary questions...
I want to study the response of cable model of neuron (with considering diffusion) to: 1. uniform extracellular electric field , 2. time variant extracellular electric field, 3.pulse of electric current and 4.temporal oscillating electric current.
I constructed a cable with hh mechanism but I dont know how can I add extracellular current/field to it. Could any body please help me?

Also I found the paper "Using NEURON for Reaction-Diffusion Modeling of Extracellular Dynamics" to add diffusion to my model. Based on this paper, Is it better to use Python for all of my simulation?

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

Re: apply extracellular electric field and current

Post by ted »

Is it better to use Python
If you're already familiar with Python, use Python. If you're already familiar with hoc and don't know much about Python, this would be a good time to switch to Python, especially if you will be doing much programming. If you don't know much (or any) Python or hoc, this is a great time to learn Python, because it seems like Python is being used for everything.

What if you have a bunch of existing hoc code that works fine? Then do what's easiest for you--if you are an experienced hoc programmer and want to stick with hoc, fine. But if you know Python, you don't have to rewrite any of the hoc code--it's easy to use it from Python. But that's a topic for another conversation.
I constructed a cable with hh mechanism but I dont know how can I add extracellular current/field to it.
See
Extracellular stimulation and recording
in the Forum's Hot tips area. Also see modeldb.yale.edu/239006. The code in extracellular_stimulation_and_recording.zip is all in hoc, but it's easy to use from Python.
firoozeh
Posts: 7
Joined: Mon Mar 09, 2020 8:40 am

Re: apply extracellular electric field and current

Post by firoozeh »

Hi all,

I used the codes in extracellular record and stim to stimulate my simple neuron model with intracellular and extracellular current. I have some questions, I will be grateful if answer them:

1) I used "record" as follows but still I can't calculate intracellular potential...

//record membrane voltage
objref dvm
dvm = new Vector()
dvm.record(&axon.v(.5))

//record extracellular voltage
objref dvex
dvex = new Vector()
dvex.record(&axon.vext[1](.5))

//calculate intracellular voltage
objref dvin
dvin= dvex+dvm //ERROR!

2) I want to save all data(voltage of every point of intra/extra cellular space and membrane in time) and do some mathematical operations. How can I create a 3D matrix(v,x,t) of all information?
Can I export my data to MATLAB?

3) I don't understand the meaning of these variables:

axon.x_xtra(0)

xScale/yScale/zScale

sElec.i_cap(0.5)

4) In a part of the file "calcrxc.hoc" talked about "Special case: uniform field between two parallel plates", if neuron settles between the uniform field in a way that electric filed lines are parallel to neuron, where must I change the code in calcrxc.hoc?

sorry for lots of questions,
Thanks
ted
Site Admin
Posts: 5793
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: apply extracellular electric field and current

Post by ted »

I used "record" as follows but still I can't calculate intracellular potential...

Code: Select all

//record membrane voltage
objref dvm 
dvm = new Vector()
dvm.record(&axon.v(.5))

//record extracellular voltage
objref dvex
dvex = new Vector()
dvex.record(&axon.vext[1](.5))[/quote]You'll also want to record time, so you can plot resuts vs. time.
Why record vext[1]? You need the potential at the external surface of the axon, which is vext[0].
[code]//calculate intracellular voltage
objref dvin
dvin= dvex+dvm //ERROR!
Python "knows" that
vectorc = vectora + vectorb
means that each element of vectorc should be assigned the value of the sum of the corresponding elements of vectora and vectorb. hoc doesn't understand that syntax, so it generates an error message. Instead, you need to use the hoc Vector class's add() method. Read about it in the Programmer's Reference
https://www.neuron.yale.edu/neuron/stat ... Vector.add
Example:

Code: Select all

objref vint
vint = dvm.c // copy dvm to vint
vint.add(dvex) // add each element of dvex to the corresponding element of vint
If you execute this before you run a simulation, vint will be empty (because dvm and dvex will be empty).
I want to save all data(voltage of every point of intra/extra cellular space and membrane in time) and do some mathematical operations. How can I create a 3D matrix(v,x,t) of all information?
Can I export my data to MATLAB?
Read the Programmer's Reference documentation about the Matrix class. I don't know what formats MATLAB reads, but I bet it can read plain text files.
I don't understand the meaning of these variables:

axon.x_xtra(0)
What do the comments in xtra.mod say about the RANGE variable x?
xScale/yScale/zScale
Search the source code for these names. Read the comments in the file that declares and uses these names. Does that give you any ideas?
sElec.i_cap(0.5)
What file contains this?
4) In a part of the file "calcrxc.hoc" talked about "Special case: uniform field between two parallel plates", if neuron settles between the uniform field in a way that electric filed lines are parallel to neuron, where must I change the code in calcrxc.hoc?
If you are using the calcrxc.hoc that is packaged in the file extracellular_stim_and_rec.zip, the question is not relevant, because that particular calcrxc.hoc assumes monopolar stimulation, not a uniform field between two parallel plates.

If you have a different version of calcrxc.hoc, which actually implements a representation of a uniform field, the answer is: nowhere. Change nothing in calcrxc.hoc. The 3d representation of the model cell itself controls the orientation of the cell relative to the field.
Post Reply