Module brainlab
[show private | hide private]
[frames | no frames]

Module brainlab

Function Summary
  addfignum(n)
  CountSpikes(brainname, rn, thresh)
examine spike report file rn, return a list of spikecounts for each cell for entire report FUTURE: allow a duration to examine instead of entire report
  DocPlot(brain, hints)
Generate a .eps of layer view, using pyx, for inclusion in scientific papers etc.
  FetchFromWorkDir(fn)
  getfignum()
  LoadReport(brainname, f)
Load text report data from NCS report f for brain brainname into an array.
  LoadReportDataText(fn, brainname, verbose)
Faster, reading entire file as one string Pretty memory hungy though and won't work on big files .
  LoadReportDataTextSlow(fn)
Slow, using readlines
  LoadSpikeData(brainname, f, starttime, endtime, fsv, thresh, bigfile, rem, verbose)
Get spike times from NCS voltage report f for brain brainname.
  nextfigure(figsize)
Wrapper for figure() to automatically get a new figure number each call.
  ReportPlot(brainname, filelist, cols, usematplotlib, plottype, plottitle, xlab, ylab, linelab, dosave, newfigure, legendloc, xrange, filter)
A voltage/current vs.
  ReportSpikePlot(brainname, filelist, usematplotlib, newfigure, xrange)
A neuroplot style false-color plot, typically used when the number of cells is large.
  run(b, verbose, nprocs, clearreports, procnum, showprogress)
Run a brain, possibly locally or on remote compute machine or cluster.
  SpikePatternPlot(brainname, filelist, starttime, endtime, fsv, thresh, newfigure, xlab, ylab, xrange)
Scatter plot showing only spike times The first method takes up lots of memory.
  ThreeDPlot(b, verbose)
get cell and synapse (and later, spike) data back show onscreen in 3d view assumes sim has already been run, and results copied back
  TimeFilterSpikeList(s, starttime, endtime)

Variable Summary
str __version__ = '1.0'
int fignum = 1                                                                     
str ncscmd = 'ncs4p'
str remdir = 'remote-invoke/'
bool remoteexec = True
str remotemachine = 'cortex.cs.unr.edu'
str TXTSEP = '-'
bool verbose = False

Function Details

CountSpikes(brainname, rn, thresh=28.0)

examine spike report file rn, return a list of spikecounts for each cell for entire report FUTURE: allow a duration to examine instead of entire report

each spike should have only 1 value greater than thresh!

change to use LoadSpikeData?

DocPlot(brain, hints=None)

Generate a .eps of layer view, using pyx, for inclusion in scientific papers etc.

should this be called from a brain.method()?

hmm, in current models all biological layers are compressed into one NCS layer and just treated as different cell groups . . .

LoadReport(brainname, f)

Load text report data from NCS report f for brain brainname into an array.

Returns numarray array. First column in file is assumed to be timestep and is discarded. Data is assumed to have same number of data values on each line.

LoadReportDataText(fn, brainname='', verbose=False)

Faster, reading entire file as one string Pretty memory hungy though and won't work on big files . . .

Requires local file. Any fetching from remote should be done prior to call. brainname should already be prepended to files only operates on one file; list of file processing should be done by caller

Change to allow reading only part of the data, within time range?

LoadReportDataTextSlow(fn)

Slow, using readlines

LoadSpikeData(brainname, f, starttime=None, endtime=None, fsv=10000, thresh=28.0, bigfile=True, rem=True, verbose=False)

Get spike times from NCS voltage report f for brain brainname.

Returns a list of lists of spike times. List returned has one list for each cell in the indicated file. So if only one cell, r[0] will be the only list of spike times.

Spike times are offset in seconds from starttime as a base (that is, if starttime is 1.0, a spike at 1.5s will be returned as a spike at 0.5 seconds.

A cache file will be saved to speed future loading (brainname-f-.txt.spk). Be careful you don't have stray cache files laying around. Tries to do performance optimation to prevent having to copy over a report file:
  1. First, load a cached saved spike file with appropriate name
  2. Try to execute LoadSpikeData on the remote, to create the .spk file, and just copy the spike file back instead of the entire voltage file
  3. Failing that, copy the whole voltage file over and load that

Assumes FSV (simulation time tick) is 10000. This is used in converting the timestep values in the report into seconds. Override with fsv= arg.

Change this at some point to return a numarray array instead of Python list.

bigfile True means line-by-line loading scheme can deal with very large files (as opposed to the regular LoadSpikeData which can be faster on smallish files but loads the whole file into memory at once and crashes on large files) THIS OPTION NOT USED RIGHT NOW.

If rem is False, won't try to do anything remotely. Useful to prevent recursion when already invoked remotely (rem=False is default when invoked from command line)

fsv and thresh only apply when file is initially loaded; when working from a stored .spk cache file, those parameters are ignored

starttime and endtime are not ignored when working from a stored .spk cache file; the full spike data will be loaded and only the spikes in the indicated range will be returned

nextfigure(figsize=None)

Wrapper for figure() to automatically get a new figure number each call. I thought figure() could automatically get a new figure with each call, but that doesn't seem to happen. Even if you draw() in between. unlike figure(), this returns int figure number instead of handle you can get the handle from the figure number via gcf() but apparently can't get the figure number from the handle At some point, figure out how to pass through all the arguments that figure() can take.

ReportPlot(brainname, filelist, cols=None, usematplotlib=True, plottype=None, plottitle=None, xlab=None, ylab=None, linelab=None, dosave=False, newfigure=True, legendloc=None, xrange=None, filter=None)

A voltage/current vs. time line plot of one or more cells.

Add countspikes param to add spike count to title on separate line? Or more general way of fetching data (if needed) and analyzing data (with stat package like R, perhaps).

If cols is None, plot all the cols in the file. Otherwise, it should be a list of cell numbers to plot. 1 is the lowest numbered cell (FIXME: compare to SpikePlot . . . )

If filter is not None, plot only every filter'th element. Useful when result will be converted to postscript and you don't want a huge file.

FIXME: now takes a single title, needs to be a list of titles if more than one file . . . should check to see if filelist is actually a list

caller must do a show() if using matplotlib Pass dosave=".ps" to save postscript, dosave=".png" to save png.

ReportSpikePlot(brainname, filelist, usematplotlib=True, newfigure=True, xrange=None)

A neuroplot style false-color plot, typically used when the number of cells is large.

No direct Gnuplot version of this; matplotlib version works though.

run(b, verbose=False, nprocs=1, clearreports=True, procnum=None, showprogress=False)

Run a brain, possibly locally or on remote compute machine or cluster.

Currently, this should not be invoked directly. It is invoked from a BRAIN's Run() method. That may change soon and the BRAIN's Run() method may be removed or deprecated.

FIXME: all .stm files in current dir are copied over. This is rather crude but easy to do and allows use of wildcard in scp. Could obviously extract the filenames from the brain.

If procnum is not None, we assume this to be a single processor job we are to execute on machine procnum. nprocs is ignored in this case.

This is called from brain.Run() method . . . is this a good way of doing it? Maybe do away with method and just make it a function.

Note: changed nlog.txt to use brainname rather than procnum, since may have multiple jobs on a procnum. Obviously, make sure brainnames are unique.

SpikePatternPlot(brainname, filelist, starttime=None, endtime=None, fsv=10000, thresh=28.0, newfigure=True, xlab=None, ylab=None, xrange=None)

Scatter plot showing only spike times The first method takes up lots of memory. Recode to avoid loading the entire thing into memory. Change to use LoadSpikeData. set xlab="" to have no x axis label, or some other string, otherwise default will be used set ylab="" to have no y axis label, or some other string, otherwise default will be used FIXME: change to use list of filenames?

ThreeDPlot(b, verbose=False)

get cell and synapse (and later, spike) data back show onscreen in 3d view assumes sim has already been run, and results copied back

Variable Details

__version__

Type:
str
Value:
'1.0'                                                                  

fignum

Type:
int
Value:
1                                                                     

ncscmd

Type:
str
Value:
'ncs4p'                                                                

remdir

Type:
str
Value:
'remote-invoke/'                                                       

remoteexec

Type:
bool
Value:
True                                                                   

remotemachine

Type:
str
Value:
'cortex.cs.unr.edu'                                                    

TXTSEP

Type:
str
Value:
'-'                                                                    

verbose

Type:
bool
Value:
False                                                                  

Generated by Epydoc 2.1 on Sat Apr 16 14:14:53 2005 http://epydoc.sf.net