Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
<style type="text/css">

:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 6253 2010-03-02 00:24:53Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.

/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
  border: 0 }

table.borderless td, table.borderless th {
  /* Override padding for "table.docutils td" with "! important".
     The right padding separates the table cells. */
  padding: 0 0.5em 0 0 ! important }

.first {
  /* Override more specific margin styles with "! important". */
  margin-top: 0 ! important }

.last, .with-subtitle {
  margin-bottom: 0 ! important }

.hidden {
  display: none }

a.toc-backref {
  text-decoration: none ;
  color: black }

blockquote.epigraph {
  margin: 2em 5em ; }

dl.docutils dd {
  margin-bottom: 0.5em }

/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
  font-weight: bold }

div.abstract {
  margin: 2em 5em }

div.abstract p.topic-title {
  font-weight: bold ;
  text-align: center }

div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
  margin: 2em ;
  border: medium outset ;
  padding: 1em }

div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
  font-weight: bold ;
  font-family: sans-serif }

div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
  color: red ;
  font-weight: bold ;
  font-family: sans-serif }

/* Uncomment (and remove this text!) to get reduced vertical space in
   compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
  margin-bottom: 0.5em }

div.compound .compound-last, div.compound .compound-middle {
  margin-top: 0.5em }

div.dedication {
  margin: 2em 5em ;
  text-align: center ;
  font-style: italic }

div.dedication p.topic-title {
  font-weight: bold ;
  font-style: normal }

div.figure {
  margin-left: 2em ;
  margin-right: 2em }

div.footer, div.header {
  clear: both;
  font-size: smaller }

div.line-block {
  display: block ;
  margin-top: 1em ;
  margin-bottom: 1em }

div.line-block div.line-block {
  margin-top: 0 ;
  margin-bottom: 0 ;
  margin-left: 1.5em }

div.sidebar {
  margin: 0 0 0.5em 1em ;
  border: medium outset ;
  padding: 1em ;
  background-color: #ffffee ;
  width: 40% ;
  float: right ;
  clear: right }

div.sidebar p.rubric {
  font-family: sans-serif ;
  font-size: medium }

div.system-messages {
  margin: 5em }

div.system-messages h1 {
  color: red }

div.system-message {
  border: medium outset ;
  padding: 1em }

div.system-message p.system-message-title {
  color: red ;
  font-weight: bold }

div.topic {
  margin: 2em }

h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  margin-top: 0.4em }

h1.title {
  text-align: center }

h2.subtitle {
  text-align: center }

hr.docutils {
  width: 75% }

img.align-left, .figure.align-left, object.align-left {
  clear: left ;
  float: left ;
  margin-right: 1em }

img.align-right, .figure.align-right, object.align-right {
  clear: right ;
  float: right ;
  margin-left: 1em }

img.align-center, .figure.align-center, object.align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;

.align-left {
  text-align: left }

.align-center {
  clear: both ;
  text-align: center }

.align-right {
  text-align: right }

/* reset inner alignment in figures */
div.align-right {
  text-align: left }

/* div.align-center * { */
/*   text-align: left } */

ol.simple, ul.simple {
  margin-bottom: 1em }

ol.arabic {
  list-style: decimal }

ol.loweralpha {
  list-style: lower-alpha }

ol.upperalpha {
  list-style: upper-alpha }

ol.lowerroman {
  list-style: lower-roman }

ol.upperroman {
  list-style: upper-roman }

p.attribution {
  text-align: right ;
  margin-left: 50% }

p.caption {
  font-style: italic }

p.credits {
  font-style: italic ;
  font-size: smaller }

p.label {
  white-space: nowrap }

p.rubric {
  font-weight: bold ;
  font-size: larger ;
  color: maroon ;
  text-align: center }

p.sidebar-title {
  font-family: sans-serif ;
  font-weight: bold ;
  font-size: larger }

p.sidebar-subtitle {
  font-family: sans-serif ;
  font-weight: bold }

p.topic-title {
  font-weight: bold }

pre.address {
  margin-bottom: 0 ;
  margin-top: 0 ;
  font: inherit }

pre.literal-block, pre.doctest-block {
  margin-left: 2em ;
  margin-right: 2em }

span.classifier {
  font-family: sans-serif ;
  font-style: oblique }

span.classifier-delimiter {
  font-family: sans-serif ;
  font-weight: bold }

span.interpreted {
  font-family: sans-serif }

span.option {
  white-space: nowrap }

span.pre {
  white-space: pre }

span.problematic {
  color: red }

span.section-subtitle {
  /* font-size relative to parent (h1..h6 element) */
  font-size: 80% }

table.citation {
  border-left: solid 1px gray;
  margin-left: 1px }

table.docinfo {
  margin: 2em 4em }

table.docutils {
  margin-top: 0.5em ;
  margin-bottom: 0.5em }

table.footnote {
  border-left: solid 1px black;
  margin-left: 1px }

table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
  padding-left: 0.5em ;
  padding-right: 0.5em ;
  vertical-align: top }

table.docutils th.field-name, table.docinfo th.docinfo-name {
  font-weight: bold ;
  text-align: left ;
  white-space: nowrap ;
  padding-left: 0 }

h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  font-size: 100% }

ul.auto-toc {
  list-style-type: none }

<div class="document">

<div class="section" id="g-3-python-tools-ver-1">
<h1>G-3 Python Tools ver. 1</h1>
<p>This is a preliminary version of a collection of stand-alone python-based
graphical utilities for plotting the output of GENESIS 2.3 and GENESIS 3
(G-3) simulations.  The simulations use the asc_file object to write
simulation variables to a file, with one line per step of the output clock.
These scripts may also be useful as prototypes of graphical objects that
could be more directly incorporated into the GENESIS 3 GUI.  Although some
of them are specialized for output generated from the 'ACnet-2' layer 4
auditory cortex model, they are designed to be easily 'hacked' for
other uses and other simulators.</p>
<p>All of these scripts make use of the powerful scientific graphics
capability of Matplotlib, which easily generates a wide variety of plots,
accompanied by a Navigation Toolbar that allows for panning and zooming of
plots, and saving to publication quality PNG format images.</p>
<p>In order to run these scripts, you will need python version 2.5 or later,
and the Matplotlib library for python, which can be downloaded from
<a class="reference external" href="http://sourceforge.net/projects/matplotlib">http://sourceforge.net/projects/matplotlib</a>.  The installation instructions
explain other requirememts, such as NumPy (numerical libraries for python)
that are usually installed along with python on most Linux systems.</p>
<p>The main script of this package, G3Plot.py also requires wxPython, the
python implemention of the wxWidgets widget set used by GENESIS 3.</p>
<p>The use of these python libraries is described in the Frontiers in
Neuroinformatics special issue on Python in Neuroscience
at <a class="reference external" href="http://frontiersin.org/neuroscience/neuroinformatics/specialtopics/8/">http://frontiersin.org/neuroscience/neuroinformatics/specialtopics/8/</a>.
More information and documentation for Matplotlib can be found at
<a class="reference external" href="http://matplotlib.sourceforge.net/">http://matplotlib.sourceforge.net/</a>.</p>
<div class="section" id="python-scripts">
<h1>Python scripts</h1>
<p>Here is a brief description of the scripts and their usage:</p>
<p><em>plotVm.py</em> - A simple utility for ploting membrane potentials, that uses
the Matplotlib object-oriented classes. It takes multiple wildcarded
filenames as a argumments, and plots them in different colors on the same
axes, e.g.</p>
plotVm.py Vm.out pyr4*.out</blockquote>
<p>It has labels and scales specific for membrane potenntial plots, and is
handy for quickly comparing the results of current injection simulations.
The (x,y) coordinates of a point on the graph can be displayed in the
Navigation Toolbat by positioning the cursor over it.</p>
<p>gipyplot.py - A much improved and more general version of plotVm, that
can overplot multi-column data from single or multiple files.  It also
has command line options, including '-h' for help.  More details are
given in the file <a class="reference external" href="README-gipyplot.html">README-gipyplot.html</a>.</p>
<p><em>rasterplot.py</em> - Similar to plotVm, but specialized for creating raster
plots of firing times for a group of neurons.  It takes a single filename
as argument, with a line for each cell containing the spike times separated
by spaces.  The times are plotted as dots with the time on the x-axis and
the cell number (the line number) on the y-axis.</p>
<p>The image <a class="reference external" href="rasterplot.png">rasterplot.png</a> shows the plot generated with</p>
rasterplot.py spike_times.txt</blockquote>
<p><em>G3Plot.py</em> - This is an enhanced version of plotVm that wraps Matplotlib
plots within a wxPhython GUI.  This has several fancy Help menu features
and plotting options to illustrate (and for me to learn about) the
capabilities of wxWidgets as a GUI for displaying simulation results in
Python.  It can either take the filename list as arguments, or to be
entered in a dialog from the File/Open menu selection.</p>
<p>It addition to the usual Menu bar with File and Help menus, it has a
Control Panel of colored buttons and toggles for clearing the plot,
plotting, setting overlay ON or OFF, and toggling the Legend display.
The Legend identifies each colored line on the graph with the filename in
the same color.</p>
<p>The HTML Usage help describes the use of the Matplotlib Toolbar that is
used in these programs, as well as Menu choices and Control Panel
buttons.  The Program Info scrolling message dialog gives information
obtained from program documentation strings about the objects and
functions, and the wxPython and matplotlib classes that are used here.</p>
<p>The image <a class="reference external" href="G3Plot-demo.png">G3Plot-demo.png</a> shows a screen dump of the
GUI with Usage and About help displayed with the plot produced by</p>
G3Plot.py pyr4*.out Vm.out</blockquote>
<p><em>rowrateplot.py</em> - This is a utility for analyzing network activity by
displaying a filled contour map of spike frequency vs. simulation time for
groups of neurons.  It takes a single filename as argument.  The first line
is a header with the total number of lines in file (nlines) and number of
values/line (ncols).  The remaining lines contain data, with a line for
each time step containing the simulation time, followed by the average
spike frequency (firing rate) during that time step for each group of
cells.  Typically each cell group is a horizontal row of cells in the
network that are receiving auditory input.  Time is plotted on the x-axis,
cell group (row) on the y-axis, with the average firing frequency of cells
in that row at that time represented by a colored filled contour plot.</p>
<p>The image <a class="reference external" href="freqplot-HD2500-11p.png">freqplot-HD2500-11p.png</a> shows the
contour plot generated from</p>
rowrateplot.py spike_freq_HD2500-11p.txt</blockquote>
<p>The data file was produced from asc_file output of an early version of the
GENESIS 2 layer 4 auditory cortex simulation 'ACnet2'.  The parameters used
for the connection weights in this run provided strong response to the
random background input, and to a 220 Hz tone pulse with thalamic input to
row 25 and nearby rows, lasting from 0.25 to 0.75 seconds.  rowrateplot.py
has been useful for tuning parameters to balance excitation and inhibition.</p>
<p><em>netview.py</em> (G-3 Network View 1.7) - a stand-alone Python application for
viewing the output of GENESIS 2 and 3 network simulations.  It is intended
to replace GENESIS 2 SLI scripts that use the XODUS 'xview' widget.  The
image created with Netview is an animated representation of a rectangular
network with colored squares used to indicate the value of some variable at
that position and time.  Typically, this would be the membrane potenial of
a cell soma, or a synaptic current in a dendrite segment.  The Help menu
'Usage and Help' selection provides a pop-up window telling you how to use
the program and describing the format of the data files. Note that files
compressed with <em>bzip2</em> can be read with netview, making data storage
very efficient.</p>
<p><em>netview-I.py</em> - a slightly hacked version of netview.py that
has a color scale adjustment for EPSC data that contains a few
very large synaptic current values at the beginning of the file.</p>
<p><em>plotPSD.py</em> and <em>plotPSD0.py</em> are very simple scripts that use the
Matplotlib 'psd' module to calculate the Power Spectral Density (PSD) of
time series data. These 'hackable' scripts were written for analyzing the
summed Excitatory Post Synaptic Current (EPSC) from all the cells in a
network, but can be used for any data with a pair of (t, x) values per
line. Also note from the Python code, that the PSD is calculated from four
overlapping windows into the length of the data.  They take a single file
or wildcard list of files as arguments.</p>
<p>A typical usage would be:</p>
<pre class="literal-block">
$ plotPSD.py EPSC_sum_M0005*
Plottting average of  4 runs from series  M0005
EPSC_sum_M0005B.txt EPSC_sum_M0005D.txt EPSC_sum_M0005E.txt EPSC_sum_M0005.txt
<p><em>plotPSD.py</em> averages the PSD from all the files, and would be used when
the files in the example above are different runs with different random
initial conditions, to be combined. <em>plotPSD0.py</em> is similar, but it
overplots the spectra on the same graph. This is used when comparing runs
that have different parameters or different models.</p>
<div class="section" id="python-implementation-of-genesis-xodus-widgets">
<h1>Python implementation of GENESIS/XODUS widgets</h1>
<p>A set of wxPython 'widgets' has been developed to mimic the appearance
of the basic GENESIS 2 XODUS widget set.  This makes it possible to
build similar GUIs for simulations in G-3 or other simulators.</p>
<p>The tutorial <a class="reference external" href="http://genesis-sim.org/userdocs/tutorial-python-gui/tutorial-python-gui.html">Creating a G-3 GUI with Python</a>
contains the Python code for the widgets, and describes how to add a
graphical environment to a Python G-3 simulation, similar to the GENESIS
2.3 XODUS version.</p>
<div class="section" id="other-related-files">
<h1>Other related files</h1>
<p>Vm.out - Typical membrane potential from simplecell current injection.</p>
<p>pyr4_Vm.out, pyr4a_Vm.out - Membrane potential from 0.5 nA injection to
soma of symmetric and asymmetric layer 4 pyramidal cell models.</p>
<p>spike_times.txt - Sample output for a raster plot, produced by raster_data.g</p>
<p>raster_data.g - A GENESIS 2 script to generate sample spike time data for
rasterplot.py.  It creates an array of 128 unconnected single compartment
cells based on basic-cell.p.  The setrandfield command is used to provide
injection randomly distributed from 0.27 to 0.33 nA.  It uses XODUS
graphics (which is optional) and some features of the table object
that have not yet been implemented in G3 to produce the output file
<dl class="docutils">
<dt>spike_freq_HD2500-11p.txt - Output of network simulation run HD2500-11p</dt>
<dd>for average spike frequency of each row vs. time.</dd>
<p>basic-cell.p -  The cell parameter file for the single compartment neuron.</p>
<div class="section" id="bugs-and-features">
<h1>BUGS and &quot;features&quot;</h1>
<p>Under Fedora 12 Linux, the scripts plotVm.py and rasterplot.py produce the
warning message:</p>
DeprecationWarning: Use the new widget gtk.Tooltip self.tooltips = gtk.Tooltips()</p>
<p>G3Plot.py does not produce this warning, but does not show the (x,y)
coordinates of the cursor in the Navigation Toolbar.  This is a very handy
feature of plotVm.py, when measuring action potential times and amplitudes.</p>
<p>Note that G3Plot uses the Matplotlib backend API for embedding in wxPython,
matplotlib.backends.backend_wxagg NavigationToolbar2WxAgg.  The other
scripts, which do not use wxPython, use matplotlib.pyplot.figure, which has
the Toolbar built in.  Possibly, there is a setting to enable this feature
hidden somewhere in NavigationToolbar2WxAgg.</p>
<p>Dave Beeman
Wed Aug 28 16:19:00 MDT 2013</p>