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

.. only:: html

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

        :ref:`Go to the end <sphx_glr_download_examples_data_collection_emg_export.py>`
        to download the full example code

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

.. _sphx_glr_examples_data_collection_emg_export.py:


Delsys EMG Export
=================

This example shows how to process and visualize the EMG data.

.. GENERATED FROM PYTHON SOURCE LINES 7-25

.. code-block:: default


    import rofunc as rf
    import numpy as np
    import matplotlib.pyplot as plt

    emg = np.load('/home/ubuntu/Data/emg_record/20221202_181154.npy')
    SAMPING_RATE = 2000
    k = 4
    n = 4
    data_filter, data_clean, data_mvc, data_abs = rf.emg.process_all_channels(emg, n, SAMPING_RATE, k)

    for i in range(n):
        rf.emg.plot_raw_and_clean(data_filter[:, i], data_clean[:, i], k)
        rf.emg.plot_abs_and_mvc(data_abs[:, i], data_mvc[:, i], k)
    plt.show()

    # # process single channel
    # data_filter_1, data_clean_1, data_mvc_1, data_abs_1 = process(emg[:, 0], SAMPING_RATE, n)
    # data_filter_2, data_clean_2, data_mvc_2, data_abs_2 = process(emg[:, 1], SAMPING_RATE, n)

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

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


.. _sphx_glr_download_examples_data_collection_emg_export.py:

.. only:: html

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




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

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

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

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


.. only:: html

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

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