Skip to content

Commit

Permalink
Refactor lsl stream (#326)
Browse files Browse the repository at this point in the history
* add first rmap and CEBRA example

* add example cebra

* rm files not available in main

* Minor changes on top of mne_lsl merge

* refactor

* converted lsl example to .py file, shortend lsl tests ,added testing for lsl

* add pypandoc install

* add pypandoc to gitignore

* adjustments in tests and changes in stream naming and stream auto detection

* player not auto creating raw file when running

* changed naming of player stream, debugging

* added test for lsl data

* debug data test

* Cleanup test

* Update nm_stream_offline.py

merge imports

Co-Authored-By: Toni M. Brotons <10654467+toni-neurosc@users.noreply.github.com>

* Update nm_mnelsl_stream.py

Added keyword for LSLStream wait till disconnect

* changes in imports in tests, added docstrings in functions, added channel type as param for player

* fix bug pandoc sphinx build

* embedd html example link

* adapt LSL example

* add sphinx-gallery embedded CEBRA example

* modify path for GH Actions documentation

* delete dead code, change np.array_equal to np.allclose

* fix path issue for running LSL documentation

* change naming in lsl player, fixture for lsl player and lsl test

* add thumbnail dor documentation

* Add sleep command to not hog cpu

* add support for raw files/paths/ data,sfreq in player

* Update nm_IO.py - delete unused params in get bids data

* fix read_BIDS unused parameters

* Update __init__.py - fix matplotlib backend for mac

* Update __init__.py fix import

* fix platform import

* fix platform import

---------

Co-authored-by: timonmerk <timon.merk@charite.de>
Co-authored-by: Antonio Martinez Brotons <10654467+toni-neurosc@users.noreply.github.com>
Co-authored-by: Samed Rouven Vossberg <57455873+MateGram@users.noreply.github.com>
Co-authored-by: timonmerk <timon.merk95@gmail.com>
  • Loading branch information
5 people authored May 30, 2024
1 parent e1b2497 commit be695d1
Show file tree
Hide file tree
Showing 32 changed files with 10,112 additions and 1,583 deletions.
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ docs/source/data/*

examples/data/derivatives/*
examples/other_examples/*
examples/plot_7_lsl_example.ipynb
examples/lange_n8.ipynb

examples/sub/*
examples/utils/*
Expand All @@ -164,6 +166,16 @@ py_neuromodulation/ConnectivityDecoding/connectome_folder/*

plot_0_first_demo.py
plot_1_example_BIDS.py
temp_raw.fif

requirements.lock
requirements-dev.lock
requirements-dev.lock

docs/source/bin/pandoc

docs/source/sg_execution_times.rst

figures_ucsf/*
catboost_info/*
out_per
.DS_Store
Binary file added docs/source/_static/CEBRA_embedding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions docs/source/api_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Feature Estimation
.. toctree::
:maxdepth: 4

nm_features_abc
nm_features
nm_filter
nm_oscillatory
Expand All @@ -50,5 +49,3 @@ Analysis
nm_plots
nm_RMAP
nm_stats
nm_cohortwrapper
nm_across_patient_decoding
51 changes: 28 additions & 23 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
if os.path.basename(SCRIPT_DIR) == "source":
# this check is necessary, so we can also run the script from the root directory
SCRIPT_DIR = os.path.join(os.path.dirname(os.path.dirname(SCRIPT_DIR)), "py_neuromodulation")
SCRIPT_DIR = os.path.join(
os.path.dirname(os.path.dirname(SCRIPT_DIR)), "py_neuromodulation"
)
print(f"Script Directory to add: {SCRIPT_DIR}")
sys.path.append(SCRIPT_DIR)

Expand All @@ -29,40 +31,44 @@


# -- Project information -----------------------------------------------------
project = 'py_neuromodulation'
copyright = '2021, Timon Merk'
author = 'Timon Merk'
project = "py_neuromodulation"
copyright = "2021, Timon Merk"
author = "Timon Merk"

source_parsers = {
'.md': 'recommonmark.parser.CommonMarkParser',
".md": "recommonmark.parser.CommonMarkParser",
}

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx.ext.autosectionlabel',
'sphinx_gallery.gen_gallery',
'sphinx_togglebutton',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.autosectionlabel",
"sphinx_gallery.gen_gallery",
"sphinx_togglebutton",
# "nbsphinx",
]

source_suffix = ['.rst', '.md', ]
source_suffix = [
".rst",
".md",
]

autosummary_generate = True

PYDEVD_DISABLE_FILE_VALIDATION=1
PYDEVD_DISABLE_FILE_VALIDATION = 1

sphinx_gallery_conf = {
"examples_dirs": "../../examples",
"gallery_dirs": "auto_examples",
"within_subsection_order" : sphinx_gallery.sorting.FileNameSortKey,
"within_subsection_order": sphinx_gallery.sorting.FileNameSortKey,
}

#sphinx_gallery_conf = {
# sphinx_gallery_conf = {
# "examples_dirs": "../../examples",
# "gallery_dirs": "auto_examples",
# #'plot_gallery': True,
Expand All @@ -71,14 +77,14 @@
# 'show_memory': True,
# 'notebook_images': 'https://py-neuromodulation.readthedocs.io/en/latest/',
# 'default_thumb_file': os.path.join('_static', 'RMAP_figure.png'),
#}
# }

templates_path = ["_templates"]
exclude_patterns = []


html_theme = "pydata_sphinx_theme"
html_static_path = ['_static']
html_static_path = ["_static"]

html_theme_options = {
"show_nav_level": 4,
Expand All @@ -100,6 +106,5 @@
"matplotlib": ("https://matplotlib.org/stable", None),
"numba": ("https://numba.readthedocs.io/en/latest", None),
"mne": ("https://mne.tools/stable", None),
"pandas" : ("https://pandas.pydata.org/docs", None),
"pandas": ("https://pandas.pydata.org/docs", None),
}

5 changes: 0 additions & 5 deletions docs/source/nm_across_patient_decoding.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/source/nm_cohortwrapper.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/source/nm_features_abc.rst

This file was deleted.

61 changes: 61 additions & 0 deletions docs/source/sg_execution_times.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

:orphan:

.. _sphx_glr_sg_execution_times:


Computation times
=================
**00:25.522** total execution time for 9 files **from all galleries**:

.. container::

.. raw:: html

<style scoped>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
</style>
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
<script type="text/javascript" class="init">
$(document).ready( function () {
$('table.sg-datatable').DataTable({order: [[1, 'desc']]});
} );
</script>

.. list-table::
:header-rows: 1
:class: table table-striped sg-datatable

* - Example
- Time
- Mem (MB)
* - :ref:`sphx_glr_auto_examples_plot_7_lsl_example.py` (``..\..\examples\plot_7_lsl_example.py``)
- 00:25.497
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_8_cebra_example.py` (``..\..\examples\plot_8_cebra_example.py``)
- 00:00.025
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_0_first_demo.py` (``..\..\examples\plot_0_first_demo.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_1_example_BIDS.py` (``..\..\examples\plot_1_example_BIDS.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_2_example_add_feature.py` (``..\..\examples\plot_2_example_add_feature.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_3_example_sharpwave_analysis.py` (``..\..\examples\plot_3_example_sharpwave_analysis.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_4_example_gridPointProjection.py` (``..\..\examples\plot_4_example_gridPointProjection.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_5_example_rmap_computing.py` (``..\..\examples\plot_5_example_rmap_computing.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_6_real_time_demo.py` (``..\..\examples\plot_6_real_time_demo.py``)
- 00:00.000
- 0.0
1 change: 0 additions & 1 deletion examples/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

Examples
========

Loading

0 comments on commit be695d1

Please sign in to comment.