psection-like dump of global parameters

The basics of how to develop, test, and use models.
Post Reply
patoorio
Posts: 81
Joined: Wed Jan 30, 2008 12:46 pm

psection-like dump of global parameters

Post by patoorio »

Hi,

Is there a way to dump the global parameters for all the inserted mechanisms and processes? psection() only dumps the RANGE parameters (otherwise it wouldn't be called psection() ).
Moreover, I would like to produce such dump without having to know a priori which mechanisms/processes are inserted.

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

Post by ted »

forall statement
will execute statement in the context of each section, one at a time.
However, psection() is not the best tool for dissecting the properties of a model. For one
thing, it cannot tell you anything about inhomogeneity of a range variable along the length of
a section.

Model View is probably the best tool for discovering the properties of models of individual
neurons. See "ModelView: Compact display of parameters for NEURON models" on the
Documentation page http://www.neuron.yale.edu/neuron/docs
In addition to giving you a browsable outline, it can write a summary of these properties to
a text or XML file (click on its File button, then select which kind of output you want).
patoorio
Posts: 81
Joined: Wed Jan 30, 2008 12:46 pm

Post by patoorio »

Thanks Ted for your answer.
ModelView does exactly what I want. Well, it probably does much more than what I need -but I can handle that.
Now my problem is that I want to do it programatically (i.e., write a hoc code that will generate a text file with all the info that Model View gives).

I dug into mview.hoc and all the hoc files it called, and found that I need to call modelview.text(). But I can't! It doesn't even work if I wrote modelview.text() in the terminal window, with the Model View GUI open. What am I missing here?

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

Post by ted »

patoorio wrote:I dug into mview.hoc and all the hoc files it called
Excellent!
and found that I need to call modelview.text(). But I can't! It doesn't even work if I wrote modelview.text() in the terminal window, with the Model View GUI open. What am I missing here?
I don't see that print is a public member of anything in nrn/lib/hoc/mview
Even if it was, it would probably bring up a "directory browser/file selector" GUI tool that
asks you to enter the name of the file to be printed.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Post by hines »

It doesn't even work if I wrote modelview.text()
To excute a method of an object you need a reference to the object.
In your case you can probably use

Code: Select all

ModelView[0].text()
However that will pop up a file chooser first.
I should modify the method so that if it is called with a filename arg
it prints to the file without any further user interaction. Til then feel free to
modify the nrn/lib/hoc/mview/mview1.hoc:proc text() method or add a
similar one to the file and make it public.
patoorio
Posts: 81
Joined: Wed Jan 30, 2008 12:46 pm

Post by patoorio »

Well, it was kind of easy.

Modified the mview1.hoc file:
- Added textp to one of the public statements
- Inserted the following code:

Code: Select all

proc textp() {local i  localobj file
	file = new File()
	file.wopen($s1)
	for i=0, display.top.count-1 {
		textout(file, display.top.object(i))
	}
	file.close()
}
Then, I have to type (or insert in the hoc file):

Code: Select all

load_file("mview.hoc")
mview()
ModelView[0].textp("filename.ext")
But now I want to know: How do I programatically close the Model View window? I couldn't find the appropriate command.
And probably more important: If the ModelView is closed and opened again during the same neuron session, it will be no longer ModelView[0] but ModelView[1] (or [2], or [3]...). How can I deal with that? In other words, is there a way to unambiguously call the last ModelView instance? (I guess this will apply to every time one wants to call the last instance of any object).
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Post by hines »

To open a ModelView without a gui use

Code: Select all

load_file("mview.hoc")
objref m
m = new ModelView(0)
m.textp("filename.ext")
ModelView is the center of a constellation of mutually referencing objects so to destroy
use

Code: Select all

m.destroy()
objref m
But to answer your question as to how to close a ModelView window, use
ModelView[0].gui.b.unmap
patoorio
Posts: 81
Joined: Wed Jan 30, 2008 12:46 pm

Post by patoorio »

Excellent!!

Thanks a lot.
Tom Close

Re: psection-like dump of global parameters

Post by Tom Close »

Thanks Patoorio, Ted, Michael, this method works nicely. However, is there a straightforward way to extend it to also print out the names of the secctions in each of the the ModelViewParmSubsets?
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: psection-like dump of global parameters

Post by ted »

Presumably the subsets are implemented as SectionLists, in which case
forsec sectionlistname print secname()
should work.
Post Reply