/usr/share/doc/python-neo/html/io.html is in python-neo 0.3.3-2.
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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | <!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>Neo IO — 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="Examples" href="examples.html" />
<link rel="prev" title="Typical use cases" href="usecases.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<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="examples.html" title="Examples"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="usecases.html" title="Typical use cases"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Neo 0.3.3 documentation</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<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="#">Neo IO</a><ul>
<li><a class="reference internal" href="#preamble">Preamble</a></li>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#one-format-one-class">One format = one class</a></li>
<li><a class="reference internal" href="#modes">Modes</a></li>
<li><a class="reference internal" href="#supported-objects-readable-objects">Supported objects/readable objects</a></li>
<li><a class="reference internal" href="#lazy-and-cascade-options">Lazy and cascade options</a></li>
<li><a class="reference internal" href="#details-of-api">Details of API</a></li>
<li><a class="reference internal" href="#module-neo.io">List of implemented formats</a></li>
<li><a class="reference internal" href="#if-you-want-to-develop-your-own-io">If you want to develop your own IO</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="usecases.html"
title="previous chapter">Typical use cases</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="examples.html"
title="next chapter">Examples</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/io.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<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" role="main">
<div class="section" id="neo-io">
<h1>Neo IO<a class="headerlink" href="#neo-io" title="Permalink to this headline">¶</a></h1>
<div class="section" id="preamble">
<h2>Preamble<a class="headerlink" href="#preamble" title="Permalink to this headline">¶</a></h2>
<p>The Neo <code class="xref py py-mod docutils literal"><span class="pre">io</span></code> module aims to provide an exhaustive way of loading and saving several widely used data formats in electrophysiology.
The more these heterogeneous formats are supported, the easier it will be to manipulate them as Neo objects in a similar way.
Therefore the IO set of classes propose a simple and flexible IO API that fits many format specifications.
It is not only file-oriented, it can also read/write objects from a database.</p>
<p><a class="reference internal" href="#module-neo.io" title="neo.io"><code class="xref py py-mod docutils literal"><span class="pre">neo.io</span></code></a> can be seen as a <em>pure-Python</em> and open-source Neuroshare replacement.</p>
<dl class="docutils">
<dt>At the moment, there are 3 families of IO modules:</dt>
<dd><ol class="first last arabic simple">
<li>for reading closed manufacturers’ formats (Spike2, Plexon, AlphaOmega, BlackRock, Axon, ...)</li>
<li>for reading(/writing) formats from open source tools (KlustaKwik, Elan, WinEdr, WinWcp, PyNN, ...)</li>
<li>for reading/writing Neo structure in neutral formats (HDF5, .mat, ...) but with Neo structure inside (NeoHDF5, NeoMatlab, ...)</li>
</ol>
</dd>
</dl>
<p>Combining <strong>1</strong> for reading and <strong>3</strong> for writing is a good example of use: converting your datasets
to a more standard format when you want to share/collaborate.</p>
</div>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>There is an intrinsic structure in the different Neo objects, that could be seen as a hierachy with cross-links. See <a class="reference internal" href="core.html"><em>Neo core</em></a>.
The highest level object is the <code class="xref py py-class docutils literal"><span class="pre">Block</span></code> object, which is the high level container able to encapsulate all the others.</p>
<p>A <code class="xref py py-class docutils literal"><span class="pre">Block</span></code> has therefore a list of <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code> objects, that can, in some file formats, be accessed individually.
Depending on the file format, i.e. if it is streamable or not, the whole <code class="xref py py-class docutils literal"><span class="pre">Block</span></code> may need to be loaded, but sometimes
particular <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code> objects can be accessed individually.
Within a <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code>, the same hierarchical organisation applies.
A <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code> embeds several objects, such as <code class="xref py py-class docutils literal"><span class="pre">SpikeTrain</span></code>,
<code class="xref py py-class docutils literal"><span class="pre">AnalogSignal</span></code>, <code class="xref py py-class docutils literal"><span class="pre">AnaloSignalArray</span></code>, <code class="xref py py-class docutils literal"><span class="pre">EpochArray</span></code>, <code class="xref py py-class docutils literal"><span class="pre">EventArray</span></code>
(basically, all the different Neo objects).</p>
<p>Depending on the file format, these objects can sometimes be loaded separately, without the need to load the whole file.
If possible, a file IO therefore provides distinct methods allowing to load only particular objects that may be present in the file.
The basic idea of each IO file format is to have, as much as possible, read/write methods for the individual encapsulated objects,
and otherwise to provide a read/write method that will return the object at the highest level of hierarchy
(by default, a <code class="xref py py-class docutils literal"><span class="pre">Block</span></code> or a <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code>).</p>
<p>The <a class="reference internal" href="#module-neo.io" title="neo.io"><code class="xref py py-mod docutils literal"><span class="pre">neo.io</span></code></a> API is a balance between full flexibility for the user (all <code class="xref py py-meth docutils literal"><span class="pre">read_XXX()</span></code> methods are enabled)
and simple, clean and understandable code for the developer (few <code class="xref py py-meth docutils literal"><span class="pre">read_XXX()</span></code> methods are enabled).
This means that not all IOs offer the full flexibility for partial reading of data files.</p>
</div>
<div class="section" id="one-format-one-class">
<h2>One format = one class<a class="headerlink" href="#one-format-one-class" title="Permalink to this headline">¶</a></h2>
<p>The basic syntax is as follows. If you want to load a file format that is implemented in a generic <code class="xref py py-class docutils literal"><span class="pre">MyFormatIO</span></code> class:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo.io</span> <span class="kn">import</span> <span class="n">MyFormatIO</span>
<span class="gp">>>> </span><span class="n">reader</span> <span class="o">=</span> <span class="n">MyFormatIO</span><span class="p">(</span><span class="n">filename</span> <span class="o">=</span> <span class="s">"myfile.dat"</span><span class="p">)</span>
</pre></div>
</div>
<p>you can replace <code class="xref py py-class docutils literal"><span class="pre">MyFormatIO</span></code> by any implemented class, see <a class="reference internal" href="#list-of-io"><span>List of implemented formats</span></a></p>
</div>
<div class="section" id="modes">
<h2>Modes<a class="headerlink" href="#modes" title="Permalink to this headline">¶</a></h2>
<p>IO can be based on file, directory, database or fake
This is describe in mode attribute of the IO class.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo.io</span> <span class="kn">import</span> <span class="n">MyFormatIO</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">MyFormatIO</span><span class="o">.</span><span class="n">mode</span>
<span class="go">'file'</span>
</pre></div>
</div>
<p>For <em>file</em> mode the <em>filename</em> keyword argument is necessary.
For <em>directory</em> mode the <em>dirname</em> keyword argument is necessary.</p>
<dl class="docutils">
<dt>Ex:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">reader</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_1.plx'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">reader</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">TdtIO</span><span class="p">(</span><span class="n">dirname</span><span class="o">=</span><span class="s">'aep_05'</span><span class="p">)</span>
</pre></div>
</div>
</dd>
</dl>
</div>
<div class="section" id="supported-objects-readable-objects">
<h2>Supported objects/readable objects<a class="headerlink" href="#supported-objects-readable-objects" title="Permalink to this headline">¶</a></h2>
<p>To know what types of object are supported by a given IO interface:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">MyFormatIO</span><span class="o">.</span><span class="n">supported_objects</span>
<span class="go">[Segment , AnalogSignal , SpikeTrain, Event, Spike]</span>
</pre></div>
</div>
<p>Supported objects does not mean objects that you can read directly. For instance, many formats support <code class="xref py py-class docutils literal"><span class="pre">AnalogSignal</span></code>
but don’t allow them to be loaded directly, rather to access the <code class="xref py py-class docutils literal"><span class="pre">AnalogSignal</span></code> objects, you must read a <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read_segment</span><span class="p">()</span>
<span class="gp">>>> </span><span class="k">print</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="gp">>>> </span><span class="k">print</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="mi">0</span><span class="p">])</span>
</pre></div>
</div>
<p>To get a list of directly readable objects</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">MyFormatIO</span><span class="o">.</span><span class="n">readable_objects</span>
<span class="go">[Segment]</span>
</pre></div>
</div>
<p>The first element of the previous list is the highest level for reading the file. This mean that the IO has a <code class="xref py py-meth docutils literal"><span class="pre">read_segment()</span></code> method:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read_segment</span><span class="p">()</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">seg</span><span class="p">)</span>
<span class="go">neo.core.Segment</span>
</pre></div>
</div>
<p>All IOs have a read() method that returns a list of <code class="xref py py-class docutils literal"><span class="pre">Block</span></code> objects (representing the whole content of the file):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </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="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">neo.core.Segment</span>
</pre></div>
</div>
</div>
<div class="section" id="lazy-and-cascade-options">
<h2>Lazy and cascade options<a class="headerlink" href="#lazy-and-cascade-options" title="Permalink to this headline">¶</a></h2>
<p>In some cases you may not want to load everything in memory because it could be too big.
For this scenario, two options are available:</p>
<blockquote>
<div><ul class="simple">
<li><code class="docutils literal"><span class="pre">lazy=True/False</span></code>. With <code class="docutils literal"><span class="pre">lazy=True</span></code> all arrays will have a size of zero, but all the metadata will be loaded. lazy_shape attribute is added to all object that
inheritate Quantitities or numpy.ndarray (AnalogSignal, AnalogSignalArray, SpikeTrain) and to object that have array like attributes (EpochArray, EventArray)
In that cases, lazy_shape is a tuple that have the same shape with lazy=False.</li>
<li><code class="docutils literal"><span class="pre">cascade=True/False</span></code>. With <code class="docutils literal"><span class="pre">cascade=False</span></code> only one object is read (and <em>one_to_many</em> and <em>many_to_many</em> relationship are not read).</li>
</ul>
</div></blockquote>
<p>By default (if they are not specified), <code class="docutils literal"><span class="pre">lazy=False</span></code> and <code class="docutils literal"><span class="pre">cascade=True</span></code>, i.e. all data is loaded.</p>
<p>Example cascade:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read_segment</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="gp">>>> </span><span class="k">print</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">analogsignals</span><span class="p">))</span> <span class="c"># this is N</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read_segment</span><span class="p">(</span><span class="n">cascade</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</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">analogsignals</span><span class="p">))</span> <span class="c"># this is zero</span>
</pre></div>
</div>
<p>Example lazy:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read_segment</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="gp">>>> </span><span class="k">print</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="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span> <span class="c"># this is N</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">read_segment</span><span class="p">(</span><span class="n">lazy</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</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="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span> <span class="c"># this is zero, the AnalogSignal is empty</span>
<span class="gp">>>> </span><span class="k">print</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="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lazy_shape</span><span class="p">)</span> <span class="c"># this is N</span>
</pre></div>
</div>
<p>Some IOs support advanced forms of lazy loading, cascading or both (these features are currently limited to the HDF5 IO, which supports both forms).</p>
<ul>
<li><p class="first">For lazy loading, these IOs have a <code class="xref py py-meth docutils literal"><span class="pre">load_lazy_object()</span></code> method that takes a single parameter: a data object previously loaded by the same IO
in lazy mode. It returns the fully loaded object, without links to container objects (Segment etc.). Continuing the lazy example above:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">lazy_sig</span> <span class="o">=</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="c"># Empty signal</span>
<span class="gp">>>> </span><span class="n">full_sig</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">load_lazy_object</span><span class="p">(</span><span class="n">lazy_sig</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">lazy_sig</span><span class="o">.</span><span class="n">lazy_shape</span><span class="p">,</span> <span class="n">full_sig</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span> <span class="c"># Identical</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">lazy_sig</span><span class="o">.</span><span class="n">segment</span><span class="p">)</span> <span class="c"># Has the link to the object "seg"</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">full_sig</span><span class="o">.</span><span class="n">segment</span><span class="p">)</span> <span class="c"># Does not have the link: None</span>
</pre></div>
</div>
</li>
<li><p class="first">For lazy cascading, IOs have a <code class="xref py py-meth docutils literal"><span class="pre">load_lazy_cascade()</span></code> method. This method is not called directly when interacting with the IO, but its
presence can be used to check if an IO supports lazy cascading. To use lazy cascading, the cascade parameter is set to <code class="docutils literal"><span class="pre">'lazy'</span></code>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">block</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="s">'lazy'</span><span class="p">)</span>
</pre></div>
</div>
<p>You do not have to do anything else, lazy cascading is now active for the object you just loaded. You can interact with the object in the same way
as if it was loaded with <code class="docutils literal"><span class="pre">cascade=True</span></code>. However, only the objects that are actually accessed are loaded as soon as they are needed:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">block</span><span class="o">.</span><span class="n">recordingchannelgroups</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="c"># The first RecordingChannelGroup is loaded</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">block</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="c"># The first Segment and its second AnalogSignal are loaded</span>
</pre></div>
</div>
<p>Once an object has been loaded with lazy cascading, it stays in memory:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">block</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="c"># The first Segment is already in memory, its first AnalogSignal is loaded</span>
</pre></div>
</div>
</li>
</ul>
</div>
<div class="section" id="details-of-api">
<span id="neo-io-api"></span><h2>Details of API<a class="headerlink" href="#details-of-api" title="Permalink to this headline">¶</a></h2>
<dl class="docutils">
<dt>The <a class="reference internal" href="#module-neo.io" title="neo.io"><code class="xref py py-mod docutils literal"><span class="pre">neo.io</span></code></a> API is designed to be simple and intuitive:</dt>
<dd><ul class="first last simple">
<li>each file format has an IO class (for example for Spike2 files you have a <code class="xref py py-class docutils literal"><span class="pre">Spike2IO</span></code> class).</li>
<li>each IO class inherits from the <code class="xref py py-class docutils literal"><span class="pre">BaseIO</span></code> class.</li>
<li>each IO class can read or write directly one or several Neo objects (for example <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code>, <code class="xref py py-class docutils literal"><span class="pre">Block</span></code>, ...): see the <code class="xref py py-attr docutils literal"><span class="pre">readable_objects</span></code> and <code class="xref py py-attr docutils literal"><span class="pre">writable_objects</span></code> attributes of the IO class.</li>
<li>each IO class supports part of the <a class="reference internal" href="api_reference.html#module-neo.core" title="neo.core"><code class="xref py py-mod docutils literal"><span class="pre">neo.core</span></code></a> hierachy, though not necessarily all of it (see <code class="xref py py-attr docutils literal"><span class="pre">supported_objects</span></code>).</li>
<li>each IO class has a <code class="xref py py-meth docutils literal"><span class="pre">read()</span></code> method that returns a list of <code class="xref py py-class docutils literal"><span class="pre">Block</span></code> objects. If the IO only supports <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code> reading, the list will contain one block with all segments from the file.</li>
<li>each IO class that supports writing has a <code class="xref py py-meth docutils literal"><span class="pre">write()</span></code> method that takes as a parameter a list of blocks, a single block or a single segment, depending on the IO’s <code class="xref py py-attr docutils literal"><span class="pre">writable_objects</span></code>.</li>
<li>each IO is able to do a <em>lazy</em> load: all metadata (e.g. <code class="xref py py-attr docutils literal"><span class="pre">sampling_rate</span></code>) are read, but not the actual numerical data. lazy_shape attribute is added to provide information on real size.</li>
<li>each IO is able to do a <em>cascade</em> load: if <code class="docutils literal"><span class="pre">True</span></code> (default) all child objects are loaded, otherwise only the top level object is loaded.</li>
<li>each IO is able to save and load all required attributes (metadata) of the objects it supports.</li>
<li>each IO can freely add user-defined or manufacturer-defined metadata to the <code class="xref py py-attr docutils literal"><span class="pre">annotations</span></code> attribute of an object.</li>
</ul>
</dd>
</dl>
</div>
<div class="section" id="module-neo.io">
<span id="list-of-implemented-formats"></span><span id="list-of-io"></span><h2>List of implemented formats<a class="headerlink" href="#module-neo.io" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="#module-neo.io" title="neo.io"><code class="xref py py-mod docutils literal"><span class="pre">neo.io</span></code></a> provides classes for reading and/or writing
electrophysiological data files.</p>
<p>Note that if the package dependency is not satisfied for one io, it does not
raise an error but a warning.</p>
<p>neo.io.iolist provides a list of succesfully imported io classes.</p>
<p>Classes:</p>
<dl class="class">
<dt id="neo.io.AlphaOmegaIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">AlphaOmegaIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.AlphaOmegaIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading data from Alpha Omega .map files (experimental)</p>
<p>This class is an experimental reader with important limitations.
See the source code for details of the limitations.
The code of this reader is of alpha quality and received very limited
testing.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">AlphaOmegaIO</span><span class="p">(</span> <span class="n">filename</span> <span class="o">=</span> <span class="s">'File_AlphaOmega_1.map'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">blck</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_block</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="n">cascade</span> <span class="o">=</span> <span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blck</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.AsciiSignalIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">AsciiSignalIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.AsciiSignalIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading signal in generic ascii format.
Columns respresents signal. They share all the same sampling rate.
The sampling rate is externally known or the first columns could hold the time
vector.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">AsciiSignalIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'File_asciisignal_2.txt'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ 39.0625 , 0. , 0. , ..., -26.85546875 ...</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.AsciiSpikeTrainIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">AsciiSpikeTrainIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.AsciiSpikeTrainIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Classe for reading/writing SpikeTrain in a text file.
Each Spiketrain is a line.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">AsciiSpikeTrainIO</span><span class="p">(</span> <span class="n">filename</span> <span class="o">=</span> <span class="s">'File_ascii_spiketrain_1.txt'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span>
<span class="go">[<SpikeTrain(array([ 3.89981604, 4.73258781, 0.608428 , 4.60246277, 1.23805797,</span>
<span class="gp">...</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.AxonIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">AxonIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.AxonIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading abf (axon binary file) file.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">AxonIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'File_axon_1.abf'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">bl</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_block</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span>
<span class="go">[<neo.core.segment.Segment object at 0x105516fd0>]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ 2.18811035, 2.19726562, 2.21252441, ..., 1.33056641,</span>
<span class="go"> 1.3458252 , 1.3671875 ], dtype=float32) * pA, [0.0 s, 191.2832 s], sampling rate: 10000.0 Hz)>]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">eventarrays</span>
<span class="go">[]</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.BlackrockIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">BlackrockIO</code><span class="sig-paren">(</span><em>filename</em>, <em>full_range=array(8192.0) * mV</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.BlackrockIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading/writing data in a BlackRock Neuroshare ns5 files.</p>
</dd></dl>
<dl class="class">
<dt id="neo.io.BrainVisionIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">BrainVisionIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.BrainVisionIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading/writing data from BrainVision product (brainAmp, brain analyser...)</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">BrainVisionIO</span><span class="p">(</span> <span class="n">filename</span> <span class="o">=</span> <span class="s">'File_brainvision_1.eeg'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,)</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.BrainwareDamIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">BrainwareDamIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.BrainwareDamIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading Brainware raw data files with the extension ‘.dam’.</p>
<p>The read_block method returns the first Block of the file. It will
automatically close the file after reading.
The read method is the same as read_block.</p>
<p>Note:</p>
<p>The file format does not contain a sampling rate. The sampling rate
is set to 1 Hz, but this is arbitrary. If you have a corresponding .src
or .f32 file, you can get the sampling rate from that. It may also be
possible to infer it from the attributes, such as “sweep length”, if
present.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo.io.brainwaredamio</span> <span class="kn">import</span> <span class="n">BrainwareDamIO</span>
<span class="gp">>>> </span><span class="n">damfile</span> <span class="o">=</span> <span class="n">BrainwareDamIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'multi_500ms_mulitrep_ch1.dam'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">blk1</span> <span class="o">=</span> <span class="n">damfile</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">blk2</span> <span class="o">=</span> <span class="n">damfile</span><span class="o">.</span><span class="n">read_block</span><span class="p">()</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">segments</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">units</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">units</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk2</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">segments</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.BrainwareF32IO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">BrainwareF32IO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.BrainwareF32IO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading Brainware Spike ReCord files with the extension ‘.f32’</p>
<p>The read_block method returns the first Block of the file. It will
automatically close the file after reading.
The read method is the same as read_block.</p>
<p>The read_all_blocks method automatically reads all Blocks. It will
automatically close the file after reading.</p>
<p>The read_next_block method will return one Block each time it is called.
It will automatically close the file and reset to the first Block
after reading the last block.
Call the close method to close the file and reset this method
back to the first Block.</p>
<p>The isopen property tells whether the file is currently open and
reading or closed.</p>
<dl class="docutils">
<dt>Note 1:</dt>
<dd>There is always only one RecordingChannelGroup. BrainWare stores the
equivalent of RecordingChannelGroups in separate files.</dd>
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo.io.brainwaref32io</span> <span class="kn">import</span> <span class="n">BrainwareF32IO</span>
<span class="gp">>>> </span><span class="n">f32file</span> <span class="o">=</span> <span class="n">BrainwareF32IO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'multi_500ms_mulitrep_ch1.f32'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">blk1</span> <span class="o">=</span> <span class="n">f32file</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">blk2</span> <span class="o">=</span> <span class="n">f32file</span><span class="o">.</span><span class="n">read_block</span><span class="p">()</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">segments</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">spiketrains</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">units</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">units</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk2</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">segments</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.BrainwareSrcIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">BrainwareSrcIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.BrainwareSrcIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading Brainware Spike ReCord files with the extension ‘.src’</p>
<p>The read_block method returns the first Block of the file. It will
automatically close the file after reading.
The read method is the same as read_block.</p>
<p>The read_all_blocks method automatically reads all Blocks. It will
automatically close the file after reading.</p>
<p>The read_next_block method will return one Block each time it is called.
It will automatically close the file and reset to the first Block
after reading the last block.
Call the close method to close the file and reset this method
back to the first Block.</p>
<p>The isopen property tells whether the file is currently open and
reading or closed.</p>
<dl class="docutils">
<dt>Note 1:</dt>
<dd>The first Unit in each RecordingChannelGroup is always
UnassignedSpikes, which has a SpikeTrain for each Segment containing
all the spikes not assigned to any Unit in that Segment.</dd>
<dt>Note 2:</dt>
<dd>The first Segment in each Block is always Comments, which stores all
comments as Event objects. The Event times are the timestamps
of the comments as the number of days since dec 30th 1899, while the
timestamp attribute has the same value in python datetime format</dd>
<dt>Note 3:</dt>
<dd>The parameters from the BrainWare table for each condition are stored
in the Segment annotations. If there are multiple repetitions of
a condition, each repetition is stored as a separate Segment.</dd>
<dt>Note 4:</dt>
<dd>There is always only one RecordingChannelGroup. BrainWare stores the
equivalent of RecordingChannelGroups in separate files.</dd>
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo.io.brainwaresrcio</span> <span class="kn">import</span> <span class="n">BrainwareSrcIO</span>
<span class="gp">>>> </span><span class="n">srcfile</span> <span class="o">=</span> <span class="n">BrainwareSrcIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'multi_500ms_mulitrep_ch1.src'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">blk1</span> <span class="o">=</span> <span class="n">srcfile</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">blk2</span> <span class="o">=</span> <span class="n">srcfile</span><span class="o">.</span><span class="n">read_block</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">blks</span> <span class="o">=</span> <span class="n">srcfile</span><span class="o">.</span><span class="n">read_all_blocks</span><span class="p">()</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">segments</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">spiketrains</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">units</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk1</span><span class="o">.</span><span class="n">units</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk2</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blk2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">segments</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blks</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">blks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">segments</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.ElanIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">ElanIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.ElanIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Classe for reading/writing data from Elan.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">ElanIO</span><span class="p">(</span> <span class="n">filename</span> <span class="o">=</span> <span class="s">'File_elan_1.eeg'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ 89.21203613, 88.83666992, 87.21008301, ..., 64.56298828,</span>
<span class="go"> 67.94128418, 68.44177246], dtype=float32) * pA, [0.0 s, 101.5808 s], sampling rate: 10000.0 Hz)>]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span>
<span class="go">[]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">eventarrays</span>
<span class="go">[]</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.ElphyIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">ElphyIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.ElphyIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading from and writing to an Elphy file.</p>
<p>It enables reading:
- <code class="xref py py-class docutils literal"><span class="pre">Block</span></code>
- <code class="xref py py-class docutils literal"><span class="pre">Segment</span></code>
- <code class="xref py py-class docutils literal"><span class="pre">RecordingChannel</span></code>
- <code class="xref py py-class docutils literal"><span class="pre">RecordingChannelGroup</span></code>
- <code class="xref py py-class docutils literal"><span class="pre">EventArray</span></code>
- <code class="xref py py-class docutils literal"><span class="pre">SpikeTrain</span></code></p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">ElphyIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'ElphyExample.DAT'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_block</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</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="gp">>>> </span><span class="k">print</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="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">seg</span><span class="o">.</span><span class="n">eventarrays</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">anasig</span><span class="o">.</span><span class="n">_data_description</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">anasig</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_analogsignal</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="n">cascade</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
</pre></div>
</div>
<div class="last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">bl</span> <span class="o">=</span> <span class="n">Block</span><span class="p">()</span>
<span class="gp">>>> </span><span class="c"># creating segments, their contents and append to bl</span>
<span class="gp">>>> </span><span class="n">r</span><span class="o">.</span><span class="n">write_block</span><span class="p">(</span> <span class="n">bl</span> <span class="p">)</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.KlustaKwikIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">KlustaKwikIO</code><span class="sig-paren">(</span><em>filename</em>, <em>sampling_rate=30000.0</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.KlustaKwikIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Reading and writing from KlustaKwik-format files.</p>
</dd></dl>
<dl class="class">
<dt id="neo.io.MicromedIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">MicromedIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.MicromedIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading data from micromed (.trc).</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">MicromedIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'File_micromed_1.TRC'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ -1.77246094e+02, -2.24707031e+02, -2.66015625e+02,</span>
<span class="gp">...</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.NeoHdf5IO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">NeoHdf5IO</code><span class="sig-paren">(</span><em>filename=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.NeoHdf5IO" title="Permalink to this definition">¶</a></dt>
<dd><p>The IO Manager is the core I/O class for HDF5 / NEO. It handles the
connection with the HDF5 file, and uses PyTables for data operations. Use
this class to get (load), insert or delete NEO objects to HDF5 file.</p>
</dd></dl>
<dl class="class">
<dt id="neo.io.NeoMatlabIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">NeoMatlabIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.NeoMatlabIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading/writing Neo objects in MATLAB format (.mat) versions 5 to 7.2.</p>
<p>This module is a bridge for MATLAB users who want to adopt the Neo object representation.
The nomenclature is the same but using Matlab structs and cell arrays.
With this module MATLAB users can use neo.io to read a format and convert it to .mat.</p>
<dl class="docutils">
<dt>Rules of conversion:</dt>
<dd><ul class="first last simple">
<li>Neo classes are converted to MATLAB structs.
e.g., a Block is a struct with attributes “name”, “file_datetime”, ...</li>
<li>Neo one_to_many relationships are cellarrays in MATLAB.
e.g., <code class="docutils literal"><span class="pre">seg.analogsignals[2]</span></code> in Python Neo will be <code class="docutils literal"><span class="pre">seg.analogsignals{3}</span></code> in MATLAB.</li>
<li>Quantity attributes are represented by 2 fields in MATLAB.
e.g., <code class="docutils literal"><span class="pre">anasig.t_start</span> <span class="pre">=</span> <span class="pre">1.5</span> <span class="pre">*</span> <span class="pre">s</span></code> in Python
will be <code class="docutils literal"><span class="pre">anasig.t_start</span> <span class="pre">=</span> <span class="pre">1.5</span></code> and <code class="docutils literal"><span class="pre">anasig.t_start_unit</span> <span class="pre">=</span> <span class="pre">'s'</span></code> in MATLAB.</li>
<li>classes that inherit from Quantity (AnalogSignal, SpikeTrain, ...) in Python will
have 2 fields (array and units) in the MATLAB struct.
e.g.: <code class="docutils literal"><span class="pre">AnalogSignal(</span> <span class="pre">[1.,</span> <span class="pre">2.,</span> <span class="pre">3.],</span> <span class="pre">'V')</span></code> in Python will be
<code class="docutils literal"><span class="pre">anasig.array</span> <span class="pre">=</span> <span class="pre">[1.</span> <span class="pre">2.</span> <span class="pre">3]</span></code> and <code class="docutils literal"><span class="pre">anasig.units</span> <span class="pre">=</span> <span class="pre">'V'</span></code> in MATLAB.</li>
</ul>
</dd>
</dl>
<p>1 - <strong>Scenario 1: create data in MATLAB and read them in Python</strong></p>
<blockquote>
<div><p>This MATLAB code generates a block:</p>
<div class="highlight-python"><div class="highlight"><pre>block = struct();
block.segments = { };
block.name = 'my block with matlab';
for s = 1:3
seg = struct();
seg.name = strcat('segment ',num2str(s));
seg.analogsignals = { };
for a = 1:5
anasig = struct();
anasig.array = rand(100,1);
anasig.units = 'mV';
anasig.t_start = 0;
anasig.t_start_units = 's';
anasig.sampling_rate = 100;
anasig.sampling_rate_units = 'Hz';
seg.analogsignals{a} = anasig;
end
seg.spiketrains = { };
for t = 1:7
sptr = struct();
sptr.array = rand(30,1)*10;
sptr.units = 'ms';
sptr.t_start = 0;
sptr.t_start_units = 'ms';
sptr.t_stop = 10;
sptr.t_stop_units = 'ms';
seg.spiketrains{t} = sptr;
end
block.segments{s} = seg;
end
save 'myblock.mat' block -V7
</pre></div>
</div>
<p>This code reads it in Python:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">neo</span>
<span class="n">r</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">NeoMatlabIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'myblock.mat'</span><span class="p">)</span>
<span class="n">bl</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_block</span><span class="p">()</span>
<span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">spiketrains</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span>
</pre></div>
</div>
</div></blockquote>
<p>2 - <strong>Scenario 2: create data in Python and read them in MATLAB</strong></p>
<blockquote>
<div><p>This Python code generates the same block as in the previous scenario:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">neo</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">scipy</span> <span class="kn">import</span> <span class="n">rand</span>
<span class="n">bl</span> <span class="o">=</span> <span class="n">neo</span><span class="o">.</span><span class="n">Block</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'my block with neo'</span><span class="p">)</span>
<span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
<span class="n">seg</span> <span class="o">=</span> <span class="n">neo</span><span class="o">.</span><span class="n">Segment</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'segment'</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">s</span><span class="p">))</span>
<span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">seg</span><span class="p">)</span>
<span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">5</span><span class="p">):</span>
<span class="n">anasig</span> <span class="o">=</span> <span class="n">neo</span><span class="o">.</span><span class="n">AnalogSignal</span><span class="p">(</span><span class="n">rand</span><span class="p">(</span><span class="mi">100</span><span class="p">),</span> <span class="n">units</span><span class="o">=</span><span class="s">'mV'</span><span class="p">,</span> <span class="n">t_start</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="p">,</span> <span class="n">sampling_rate</span><span class="o">=</span><span class="mi">100</span><span class="o">*</span><span class="n">pq</span><span class="o">.</span><span class="n">Hz</span><span class="p">)</span>
<span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">anasig</span><span class="p">)</span>
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">7</span><span class="p">):</span>
<span class="n">sptr</span> <span class="o">=</span> <span class="n">neo</span><span class="o">.</span><span class="n">SpikeTrain</span><span class="p">(</span><span class="n">rand</span><span class="p">(</span><span class="mi">30</span><span class="p">),</span> <span class="n">units</span><span class="o">=</span><span class="s">'ms'</span><span class="p">,</span> <span class="n">t_start</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">ms</span><span class="p">,</span> <span class="n">t_stop</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">pq</span><span class="o">.</span><span class="n">ms</span><span class="p">)</span>
<span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sptr</span><span class="p">)</span>
</pre></div>
</div>
<p>w = neo.io.NeoMatlabIO(filename=’myblock.mat’)
w.write_block(bl)</p>
<p>This MATLAB code reads it:</p>
<div class="highlight-python"><div class="highlight"><pre>load 'myblock.mat'
block.name
block.segments{2}.analogsignals{3}.array
block.segments{2}.analogsignals{3}.units
block.segments{2}.analogsignals{3}.t_start
block.segments{2}.analogsignals{3}.t_start_units
</pre></div>
</div>
</div></blockquote>
<p>3 - <strong>Scenario 3: conversion</strong></p>
<blockquote>
<div><p>This Python code converts a Spike2 file to MATLAB:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">Block</span>
<span class="kn">from</span> <span class="nn">neo.io</span> <span class="kn">import</span> <span class="n">Spike2IO</span><span class="p">,</span> <span class="n">NeoMatlabIO</span>
<span class="n">r</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">'myspike2file.smr'</span><span class="p">)</span>
<span class="n">w</span> <span class="o">=</span> <span class="n">NeoMatlabIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'convertedfile.mat'</span><span class="p">)</span>
<span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</span><span class="p">()</span>
<span class="n">bl</span> <span class="o">=</span> <span class="n">Block</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'a block'</span><span class="p">)</span>
<span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">seg</span><span class="p">)</span>
<span class="n">w</span><span class="o">.</span><span class="n">write_block</span><span class="p">(</span><span class="n">bl</span><span class="p">)</span>
</pre></div>
</div>
</div></blockquote>
</dd></dl>
<dl class="class">
<dt id="neo.io.NeuroExplorerIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">NeuroExplorerIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.NeuroExplorerIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading nex file.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</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_1.nex'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ 39.0625 , 0. , 0. , ..., -26.85546875, ...</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span>
<span class="go">[<SpikeTrain(array([ 2.29499992e-02, 6.79249987e-02, 1.13399997e-01, ...</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">eventarrays</span>
<span class="go">[<EventArray: @21.1967754364 s, @21.2993755341 s, @21.350725174 s, @21.5048999786 s, ...</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">epocharrays</span>
<span class="go">[<neo.core.epocharray.EpochArray object at 0x10561ba90>, <neo.core.epocharray.EpochArray object at 0x10561bad0>]</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.NeuroScopeIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">NeuroScopeIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.NeuroScopeIO" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="class">
<dt id="neo.io.NeuroshareIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">NeuroshareIO</code><span class="sig-paren">(</span><em>filename=''</em>, <em>dllname=''</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.NeuroshareIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading file trougth neuroshare API.
The user need the DLLs in the path of the file format.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">NeuroshareIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'a_file'</span><span class="p">,</span> <span class="n">dllname</span><span class="o">=</span><span class="n">the_name_of_dll</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">import_neuroshare_segment</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ -1.77246094e+02, -2.24707031e+02, -2.66015625e+02,</span>
<span class="gp">...</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span>
<span class="go">[]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">eventarrays</span>
<span class="go">[<EventArray: 1@1.12890625 s, 1@2.02734375 s, 1@3.82421875 s>]</span>
</pre></div>
</div>
</dd>
<dt>Note:</dt>
<dd><p class="first">neuroshare.ns_ENTITY_EVENT: are converted to neo.EventArray
neuroshare.ns_ENTITY_ANALOG: are converted to neo.AnalogSignal
neuroshare.ns_ENTITY_NEURALEVENT: are converted to neo.SpikeTrain</p>
<dl class="last docutils">
<dt>neuroshare.ns_ENTITY_SEGMENT: is something between serie of small AnalogSignal</dt>
<dd>and Spiketrain with associated waveforms.
It is arbitrarily converted as SpikeTrain.</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.PickleIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">PickleIO</code><span class="sig-paren">(</span><em>filename=None</em>, <em>**kargs</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.PickleIO" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="class">
<dt id="neo.io.PlexonIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">PlexonIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.PlexonIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading plx file.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</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_1.plx'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">spiketrains</span>
<span class="go">[<SpikeTrain(array([ 2.75000000e-02, 5.68250000e-02, 8.52500000e-02, ...,</span>
<span class="gp">...</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">eventarrays</span>
<span class="go">[]</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.PyNNNumpyIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">PyNNNumpyIO</code><span class="sig-paren">(</span><em>filename=None</em>, <em>**kargs</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.PyNNNumpyIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Reads/writes data from/to PyNN NumpyBinaryFile format</p>
</dd></dl>
<dl class="class">
<dt id="neo.io.PyNNTextIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">PyNNTextIO</code><span class="sig-paren">(</span><em>filename=None</em>, <em>**kargs</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.PyNNTextIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Reads/writes data from/to PyNN StandardTextFile format</p>
</dd></dl>
<dl class="class">
<dt id="neo.io.RawBinarySignalIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">RawBinarySignalIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.RawBinarySignalIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading/writing data in a raw binary interleaved compact file.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">RawBinarySignalIO</span><span class="p">(</span> <span class="n">filename</span> <span class="o">=</span> <span class="s">'File_ascii_signal_2.txt'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="gp">...</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.TdtIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">TdtIO</code><span class="sig-paren">(</span><em>dirname=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.TdtIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading data from from Tucker Davis TTank format.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">TdtIO</span><span class="p">(</span><span class="n">dirname</span><span class="o">=</span><span class="s">'aep_05'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">bl</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_block</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span>
<span class="go">[<neo.core.segment.Segment object at 0x1060a4d10>]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ 2.18811035, 2.19726562, 2.21252441, ..., 1.33056641,</span>
<span class="go"> 1.3458252 , 1.3671875 ], dtype=float32) * pA, [0.0 s, 191.2832 s], sampling rate: 10000.0 Hz)>]</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">eventarrays</span>
<span class="go">[]</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.WinEdrIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">WinEdrIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.WinEdrIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading data from WinEDR.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">WinEdrIO</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s">'File_WinEDR_1.EDR'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">seg</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_segment</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="n">cascade</span><span class="o">=</span><span class="bp">True</span><span class="p">,)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">seg</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([ 89.21203613, 88.83666992, 87.21008301, ..., 64.56298828,</span>
<span class="go"> 67.94128418, 68.44177246], dtype=float32) * pA, [0.0 s, 101.5808 s], sampling rate: 10000.0 Hz)>]</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="neo.io.WinWcpIO">
<em class="property">class </em><code class="descclassname">neo.io.</code><code class="descname">WinWcpIO</code><span class="sig-paren">(</span><em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#neo.io.WinWcpIO" title="Permalink to this definition">¶</a></dt>
<dd><p>Class for reading from a WinWCP file.</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">neo</span> <span class="kn">import</span> <span class="n">io</span>
<span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">WinWcpIO</span><span class="p">(</span> <span class="n">filename</span> <span class="o">=</span> <span class="s">'File_winwcp_1.wcp'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">bl</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">read_block</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="n">cascade</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span>
<span class="go">[<neo.core.segment.Segment object at 0x1057bd350>, <neo.core.segment.Segment object at 0x1057bd2d0>,</span>
<span class="gp">...</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">bl</span><span class="o">.</span><span class="n">segments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">analogsignals</span>
<span class="go">[<AnalogSignal(array([-2438.73388672, -2428.96801758, -2425.61083984, ..., -2695.39453125,</span>
<span class="gp">...</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="if-you-want-to-develop-your-own-io">
<h2>If you want to develop your own IO<a class="headerlink" href="#if-you-want-to-develop-your-own-io" title="Permalink to this headline">¶</a></h2>
<p>See <a class="reference internal" href="io_developers_guide.html"><em>IO developers’ guide</em></a> for information on how to implement of a new IO.</p>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<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="examples.html" title="Examples"
>next</a> |</li>
<li class="right" >
<a href="usecases.html" title="Typical use cases"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Neo 0.3.3 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2010-2014, Neo authors and contributors <neuralensemble@googlegroups.com>.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.3.
</div>
</body>
</html>
|