/usr/share/doc/python-neo/html/examples.html is in python-neo 0.3.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | <!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Examples — Neo 0.3.3 documentation</title>
<link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.3.3',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Neo 0.3.3 documentation" href="index.html" />
<link rel="next" title="API Reference" href="api_reference.html" />
<link rel="prev" title="Neo IO" href="io.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="api_reference.html" title="API Reference"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="io.html" title="Neo IO"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Neo 0.3.3 documentation</a> »</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/neologo_light.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Examples</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="io.html"
title="previous chapter">Neo IO</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="api_reference.html"
title="next chapter">API Reference</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/examples.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="examples">
<h1>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>A set of examples in neo/examples/ illustrates the use of neo classes.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># -*- coding: utf-8 -*-</span>
<span class="sd">"""</span>
<span class="sd">This is an example for reading files with neo.io</span>
<span class="sd">"""</span>
<span class="kn">import</span> <span class="nn">urllib</span>
<span class="kn">import</span> <span class="nn">neo</span>
<span class="c"># Plexon files</span>
<span class="n">distantfile</span> <span class="o">=</span> <span class="s">'https://portal.g-node.org/neo/plexon/File_plexon_3.plx'</span>
<span class="n">localfile</span> <span class="o">=</span> <span class="s">'./File_plexon_3.plx'</span>
<span class="n">urllib</span><span class="o">.</span><span class="n">urlretrieve</span><span class="p">(</span><span class="n">distantfile</span><span class="p">,</span> <span class="n">localfile</span><span class="p">)</span>
<span class="c">#create a reader</span>
<span class="n">reader</span> <span class="o">=</span> <span class="n">neo</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">PlexonIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'File_plexon_3.plx'</span><span class="p">)</span>
<span class="c"># read the blocks</span>
<span class="n">blks</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">lazy</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
<span class="k">print</span> <span class="n">blks</span>
<span class="c"># acces to segments</span>
<span class="k">for</span> <span class="n">blk</span> <span class="ow">in</span> <span class="n">blks</span><span class="p">:</span>
<span class="k">for</span> <span class="n">seg</span> <span class="ow">in</span> <span class="n">blk</span><span class="o">.</span><span class="n">segments</span><span class="p">:</span>
<span class="k">print</span> <span class="n">seg</span>
<span class="k">for</span> <span class="n">asig</span> <span class="ow">in</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span><span class="p">:</span>
<span class="k">print</span> <span class="n">asig</span>
<span class="k">for</span> <span class="n">st</span> <span class="ow">in</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span><span class="p">:</span>
<span class="k">print</span> <span class="n">st</span>
<span class="c"># CED Spike2 files</span>
<span class="n">distantfile</span> <span class="o">=</span> <span class="s">'https://portal.g-node.org/neo/spike2/File_spike2_1.smr'</span>
<span class="n">localfile</span> <span class="o">=</span> <span class="s">'./File_spike2_1.smr'</span>
<span class="n">urllib</span><span class="o">.</span><span class="n">urlretrieve</span><span class="p">(</span><span class="n">distantfile</span><span class="p">,</span> <span class="n">localfile</span><span class="p">)</span>
<span class="c">#create a reader</span>
<span class="n">reader</span> <span class="o">=</span> <span class="n">neo</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">Spike2IO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'File_spike2_1.smr'</span><span class="p">)</span>
<span class="c"># read the block</span>
<span class="n">bl</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">lazy</span><span class="o">=</span><span class="bp">False</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">print</span> <span class="n">bl</span>
<span class="c"># acces to segments</span>
<span class="k">for</span> <span class="n">seg</span> <span class="ow">in</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">:</span>
<span class="k">print</span> <span class="n">seg</span>
<span class="k">for</span> <span class="n">asig</span> <span class="ow">in</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span><span class="p">:</span>
<span class="k">print</span> <span class="n">asig</span>
<span class="k">for</span> <span class="n">st</span> <span class="ow">in</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span><span class="p">:</span>
<span class="k">print</span> <span class="n">st</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># -*- coding: utf-8 -*-</span>
<span class="sd">"""</span>
<span class="sd">This is an example for plotting neo object with maplotlib.</span>
<span class="sd">"""</span>
<span class="kn">import</span> <span class="nn">urllib</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">quantities</span> <span class="kn">as</span> <span class="nn">pq</span>
<span class="kn">from</span> <span class="nn">matplotlib</span> <span class="kn">import</span> <span class="n">pyplot</span>
<span class="kn">import</span> <span class="nn">neo</span>
<span class="n">url</span> <span class="o">=</span> <span class="s">'https://portal.g-node.org/neo/'</span>
<span class="n">distantfile</span> <span class="o">=</span> <span class="n">url</span> <span class="o">+</span> <span class="s">'neuroexplorer/File_neuroexplorer_2.nex'</span>
<span class="n">localfile</span> <span class="o">=</span> <span class="s">'File_neuroexplorer_2.nex'</span>
<span class="n">urllib</span><span class="o">.</span><span class="n">urlretrieve</span><span class="p">(</span><span class="n">distantfile</span><span class="p">,</span> <span class="n">localfile</span><span class="p">)</span>
<span class="n">reader</span> <span class="o">=</span> <span class="n">neo</span><span class="o">.</span><span class="n">io</span><span class="o">.</span><span class="n">NeuroExplorerIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'File_neuroexplorer_2.nex'</span><span class="p">)</span>
<span class="n">bl</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">lazy</span><span class="o">=</span><span class="bp">False</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">for</span> <span class="n">seg</span> <span class="ow">in</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">:</span>
<span class="n">fig</span> <span class="o">=</span> <span class="n">pyplot</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
<span class="n">ax1</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">ax2</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="n">ax1</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="n">seg</span><span class="o">.</span><span class="n">file_origin</span><span class="p">)</span>
<span class="n">mint</span> <span class="o">=</span> <span class="mi">0</span> <span class="o">*</span> <span class="n">pq</span><span class="o">.</span><span class="n">s</span>
<span class="n">maxt</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">inf</span> <span class="o">*</span> <span class="n">pq</span><span class="o">.</span><span class="n">s</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">asig</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span><span class="p">):</span>
<span class="n">times</span> <span class="o">=</span> <span class="n">asig</span><span class="o">.</span><span class="n">times</span><span class="o">.</span><span class="n">rescale</span><span class="p">(</span><span class="s">'s'</span><span class="p">)</span><span class="o">.</span><span class="n">magnitude</span>
<span class="n">asig</span> <span class="o">=</span> <span class="n">asig</span><span class="o">.</span><span class="n">rescale</span><span class="p">(</span><span class="s">'mV'</span><span class="p">)</span><span class="o">.</span><span class="n">magnitude</span>
<span class="n">ax1</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">times</span><span class="p">,</span> <span class="n">asig</span><span class="p">)</span>
<span class="n">trains</span> <span class="o">=</span> <span class="p">[</span><span class="n">st</span><span class="o">.</span><span class="n">rescale</span><span class="p">(</span><span class="s">'s'</span><span class="p">)</span><span class="o">.</span><span class="n">magnitude</span> <span class="k">for</span> <span class="n">st</span> <span class="ow">in</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span><span class="p">]</span>
<span class="n">colors</span> <span class="o">=</span> <span class="n">pyplot</span><span class="o">.</span><span class="n">cm</span><span class="o">.</span><span class="n">jet</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span><span class="p">)))</span>
<span class="n">ax2</span><span class="o">.</span><span class="n">eventplot</span><span class="p">(</span><span class="n">trains</span><span class="p">,</span> <span class="n">colors</span><span class="o">=</span><span class="n">colors</span><span class="p">)</span>
<span class="n">pyplot</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="api_reference.html" title="API Reference"
>next</a> |</li>
<li class="right" >
<a href="io.html" title="Neo IO"
>previous</a> |</li>
<li><a href="index.html">Neo 0.3.3 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2010-2014, Neo authors and contributors <neuralensemble@googlegroups.com>.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.1.
</div>
</body>
</html>
|