.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/plot_read_files_neo_rawio.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_plot_read_files_neo_rawio.py: Reading files with neo.rawio ============================ compare with read_files_neo_io.py .. GENERATED FROM PYTHON SOURCE LINES 9-11 First we import a RawIO from neo.rawio For this example we will use PlexonRawIO .. GENERATED FROM PYTHON SOURCE LINES 11-15 .. code-block:: Python import urllib from neo.rawio import PlexonRawIO .. GENERATED FROM PYTHON SOURCE LINES 16-17 Get Plexon files .. GENERATED FROM PYTHON SOURCE LINES 17-29 .. code-block:: Python # We will be pulling these files down, but if you have a local file # then all you need to do is specify the file location on your # computer. NeuralEnsemble keeps a wide variety of freely accesible, small # test files that can be used. So for this example we will take advantage of that # fact. url_repo = "https://web.gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/" distantfile = url_repo + "plexon/File_plexon_3.plx" localfile = "File_plexon_3.plx" urllib.request.urlretrieve(distantfile, localfile) .. rst-class:: sphx-glr-script-out .. code-block:: none ('File_plexon_3.plx', ) .. GENERATED FROM PYTHON SOURCE LINES 30-31 Create a reader .. GENERATED FROM PYTHON SOURCE LINES 31-43 .. code-block:: Python # All it takes to create a reader is giving the filename (or dirname) # Then we need to do the slow step of parsing the header with the # `parse_header` function. This collects metadata as well as # make all future steps much faster for us reader = PlexonRawIO(filename="File_plexon_3.plx") reader.parse_header() print(reader) # we can view metadata in the header print(reader.header) .. rst-class:: sphx-glr-script-out .. code-block:: none PlexonRawIO: File_plexon_3.plx nb_block: 1 nb_segment: [1] signal_streams: [V (chans: 1)] signal_channels: [V1] spike_channels: [Wspk1u, Wspk2u, Wspk4u, Wspk5u ... Wspk29u , Wspk30u , Wspk31u , Wspk32u] event_channels: [] {'nb_block': 1, 'nb_segment': [1], 'signal_buffers': array([], dtype=[('name', ') .. GENERATED FROM PYTHON SOURCE LINES 124-126 Since this is a new file we need to read initialize our reader as well as parse the header .. GENERATED FROM PYTHON SOURCE LINES 126-132 .. code-block:: Python reader = PlexonRawIO(filename="File_plexon_2.plx") reader.parse_header() # if we look at this header we see it is different than the header above print(reader.header) .. rst-class:: sphx-glr-script-out .. code-block:: none {'nb_block': 1, 'nb_segment': [1], 'signal_buffers': array([], dtype=[('name', '` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_read_files_neo_rawio.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_read_files_neo_rawio.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_