
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/read_files_neo_io.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_examples_read_files_neo_io.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_read_files_neo_io.py:


Reading files with neo.io
=========================

.. GENERATED FROM PYTHON SOURCE LINES 6-49

.. code-block:: default


    import urllib

    import neo

    url_repo = 'https://web.gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/'

    # Plexon files
    distantfile = url_repo + 'plexon/File_plexon_3.plx'
    localfile = './File_plexon_3.plx'
    urllib.request.urlretrieve(distantfile, localfile)

    # create a reader
    reader = neo.io.PlexonIO(filename='File_plexon_3.plx')
    # read the blocks
    blks = reader.read(lazy=False)
    print(blks)
    # access to segments
    for blk in blks:
        for seg in blk.segments:
            print(seg)
            for asig in seg.analogsignals:
                print(asig)
            for st in seg.spiketrains:
                print(st)

    # CED Spike2 files
    distantfile = url_repo + 'spike2/File_spike2_1.smr'
    localfile = './File_spike2_1.smr'
    urllib.request.urlretrieve(distantfile, localfile)

    # create a reader
    reader = neo.io.Spike2IO(filename='File_spike2_1.smr')
    # read the block
    bl = reader.read(lazy=False)[0]
    print(bl)
    # access to segments
    for seg in bl.segments:
        print(seg)
        for asig in seg.analogsignals:
            print(asig)
        for st in seg.spiketrains:
            print(st)


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.000 seconds)


.. _sphx_glr_download_examples_read_files_neo_io.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example


    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: read_files_neo_io.py <read_files_neo_io.py>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: read_files_neo_io.ipynb <read_files_neo_io.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
