Saving Files

Post Reply
lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

Saving Files

Post by lb5999 »

Hi, I am using a Neuron 7.1 on windows and I am having some basic problems with reproducing my work. I have the following code regarding modelling 4 subthalamic neurons. This code has been entered in the hoc command, which is opened when I double click on the icon "nrngui".

Code: Select all

begintemplate SThcell
public soma, dend

create soma, dend[1]

proc init() {

    ndend = 2

    create soma, dend[ndend]

    soma {
      nseg = 1
      diam = 18.8
      L = 18.8
      Ra = 123.0
      insert hh
      gnabar_hh=0.25
      gl_hh = .0001666
      el_hh = -60.0
    }

    dend[0] {
      nseg = 5
      diam = 3.18
      L = 701.9
      Ra = 123
      insert pas
      g_pas = .0001666
      e_pas = -60.0
    }

    dend[1] {
      nseg = 5
      diam = 2.0
      L = 549.1
      Ra = 123
      insert pas
      g_pas = .0001666
      e_pas = -60.0
    }

    // Connect things together
    connect dend[0](0), soma(0)
    connect dend[1](0), soma(1)  
}
endtemplate SThcell

nSThcells = 4
objectvar SThcells[nSThcells]

for i = 0, nSThcells-1 {
    SThcells[i] = new SThcell()
}
My question is, how do I save this code and reuse it on my windows? I would appreciate a very basic step-to-step guide of how to do this, because I have tried multiple times to get this to work, and it doesn't! [I have saved this script in notepad - the best text editor on my machine which isn't the neuron nerminal nrniv - as a .hoc file, and whenever I drag and drop this into neuron (or simply double click on it), it opens a blank neuron terminal!?!?]

Thanks,

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

Re: Saving Files

Post by ted »

What did you expect to happen? Your code told NEURON to create four instances of a particular cell class, period, end of story. If you want something else to happen, your code has to say so. If you want to verify that there are some cells, try typing the command
topology()
at the oc> prompt. What did you see?

Hints:
1. Notepad is crippleware, puny by design, and far from the "best" text editor under any OS. There are many free alternatives that are far better. Some for MSWin are discussed in these threads
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=148
viewtopic.php?f=5&t=1219

2. It's a good idea to get in the habit of using Lists to manage collections of objects. Much better than arrays for many reasons. Example:

Code: Select all

NCELLS = 4
objref cells
cells = new List
for i = 0, NCELLS-1 cells.append(new SThcell())
Then each cell is known as cells.o(i) where i = 0..3 and you can iterate over all cells by

Code: Select all

for i=0, cells.count()-1 {
  . . . statements that affect a cell . . .
}
lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

Re: Saving Files

Post by lb5999 »

Ahhhhh I was expecting to see the syntax I wrote pop up in the terminal, but of course it doesn't; it just runs it and displays an empty terminal!

Thanks for your reply,

I will look into listing :)

L
Post Reply