Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ target/
# doc
_build/
auto_examples/
modules/

4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ install:
- sudo apt-get update
- pip install -r requirements.txt
- pip install -e .
- pip install sphinx-gallery
- pip install numpydoc
- pip install sphinx_bootstrap_theme
- pip install git+https://github.com/pymanopt/pymanopt
script:
- mkdir docs
- cd doc
- pip install -r requirements.txt
# - sphinx-autogen *.rst
- make html
- touch _build/html/.nojekyll
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MEEGkit

[![unit-tests](https://github.com/nbara/python-meegkit/workflows/unit-tests/badge.svg?style=flat)](https://github.com/nbara/python-meegkit/actions?workflow=unit-tests)
[![Travis](https://img.shields.io/travis/nbara/python-meegkit.svg?label=documentation&logo=travis)](https://travis-ci.org/nbara/python-meegkit)
[![documentation](https://img.shields.io/travis/nbara/python-meegkit.svg?label=documentation&logo=travis)](https://travis-ci.org/nbara/python-meegkit)
[![codecov](https://codecov.io/gh/nbara/python-meegkit/branch/master/graph/badge.svg)](https://codecov.io/gh/nbara/python-meegkit)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/nbara/python-meegkit/master)
[![twitter](https://img.shields.io/twitter/follow/lebababa?label=Twitter&style=flat&logo=Twitter)](https://twitter.com/intent/follow?screen_name=lebababa)
Expand Down
1 change: 0 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ clean:
-rm -rf _build/*
-rm -rf _source/*
-rm -rf generated
-rm -rf auto_examples/*
-rm -rf *.stc
-rm -rf *.fif
-rm -rf *.nii.gz
Expand Down
97 changes: 33 additions & 64 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
#
import os
import sys
from numpydoc import docscrape # noqa
import sphinx_gallery # noqa
import sphinx_bootstrap_theme # noqa

import matplotlib
matplotlib.use('agg')

Expand All @@ -27,9 +23,10 @@

# -- Project information -----------------------------------------------------

project = 'MEEGkit'
copyright = '2020, Nicolas Barascud'
project = f'MEEGkit v{meegkit.__version__}'
copyright = '2021, Nicolas Barascud'
author = 'Nicolas Barascud'
release = meegkit.__version__
version = meegkit.__version__

# -- General configuration ---------------------------------------------------
Expand All @@ -42,7 +39,9 @@
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'numpydoc',
'jupyter_sphinx',
'sphinx_gallery.gen_gallery',
'sphinxemoji.sphinxemoji',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -75,10 +74,8 @@

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'bootstrap'
# The theme to use for HTML and HTML Help pages
html_theme = 'pydata_sphinx_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand All @@ -87,62 +84,33 @@


html_theme_options = {
# Tab name for entire site. (Default: "Site")
'navbar_site_name': "MEEGkit documentation",

# Render the next and previous page links in navbar. (Default: true)
'navbar_sidebarrel': False,

# Links in the navbar
'navbar_links': [
("Examples", "auto_examples/index"),
("GitHub", "https://github.com/nbara/python-meegkit", True)
"show_toc_level": 1,
"external_links": [
{
"name": "GitHub",
"url": "https://github.com/nbara/python-meegkit",
}
],
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/nbara/python-meegkit",
"icon": "fab fa-github-square",
},
{
"name": "Twitter",
"url": "https://twitter.com/lebababa",
"icon": "fab fa-twitter-square",
},
],
"use_edit_page_button": True,
}

# Render the current pages TOC in the navbar. (Default: true)
'navbar_pagenav': True,

# Tab name for the current pages TOC. (Default: "Page")
'navbar_pagenav_name': "Page",

# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
'globaltoc_depth': 2,

# Include hidden TOCs in Site navbar?
#
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
# non-hidden ``toctree`` directives in the same page, or else the build
# will break.
#
# Values: "true" (default) or "false"
'globaltoc_includehidden': "true",

# HTML navbar class (Default: "navbar") to attach to <div> element.
# For black navbar, do "navbar navbar-inverse"
'navbar_class': "navbar navbar-inverse",

# Fix navigation bar to top of page?
# Values: "true" (default) or "false"
'navbar_fixed_top': "true",

# Location of link to source.
# Options are "nav" (default), "footer" or anything else to exclude.
'source_link_position': "nav",

# Bootswatch (http://bootswatch.com/) theme.
#
# Options are nothing (default) or the name of a valid theme
# such as "cosmo" or "sandstone".
#
# Currently, the supported themes are:
# - Bootstrap 2: https://bootswatch.com/2
# - Bootstrap 3: https://bootswatch.com/3
'bootswatch_theme': "united",

# Choose Bootstrap version.
# Values: "3" (default) or "2" (in quotes)
'bootstrap_version': "3",
html_context = {
"github_user": "nbara",
"github_repo": "python-meegkit",
"github_version": "master",
"doc_path": "doc",
}

# -- Options for Sphinx-gallery HTML ------------------------------------------
Expand All @@ -153,4 +121,5 @@
'gallery_dirs': 'auto_examples', # path to where to save gallery generated output
'filename_pattern': '/example_',
'ignore_pattern': 'config.py',
'run_stale_examples': False,
}
35 changes: 26 additions & 9 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
.. MEEGkit documentation master file, created by
.. ``meegkit`` documentation master file, created by
sphinx-quickstart on Fri Jan 10 12:31:49 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to MEEGkit
==================
|:brain:| ``meegkit``: EEG and MEG denoising in Python
======================================================

The code of the project is on Github: `MEEGkit <https://github.com/nbara/python-meegkit>`_
Introduction
------------

``meegkit`` is a collection of EEG and MEG denoising techniques for
**Python 3.6+**. Please feel free to contribute, or suggest new analyses. Keep
in mind that this is mostly development code, and as such is likely to change
without any notice. Also, while most of the methods have been fairly robustly
tested, bugs can (and should!) be expected.

Contents
--------
The source code of the project is hosted on Github at the following address:
https://github.com/nbara/python-meegkit

:py:mod:`meegkit`:
To get started, follow the installation instructions `in the README <https://github.com/nbara/python-meegkit#installation>`_.

Available modules
-----------------

Here is a list of the methods and techniques available in ``meegkit``:

.. currentmodule:: meegkit

.. toctree::
:maxdepth: 1

.. autosummary::
:toctree: modules/
:caption: meegkit

~meegkit.asr
~meegkit.cca
Expand All @@ -30,16 +44,19 @@ Contents
~meegkit.tspca
~meegkit.utils


Examples gallery
----------------

A gallery of examples is available at the following address:
A number of example scripts and notebooks are available:


.. toctree::
:maxdepth: 2

auto_examples/index


Indices and tables
------------------

Expand Down
30 changes: 30 additions & 0 deletions doc/modules/meegkit.trca.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
meegkit.trca
============

.. automodule:: meegkit.trca







.. rubric:: Functions

.. autosummary::

trca
TRCA













9 changes: 9 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sphinx
sphinx-copybutton
sphinxemoji
pydata-sphinx-theme
numpydoc
matplotlib
pillow
sphinx-gallery
jupyter-sphinx
8 changes: 6 additions & 2 deletions examples/README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
MEEGkit examples
Examples gallery
================

Below is a gallery of examples
Below is a list of example scripts showing basic usage for most methods in
MEEGkit.

The examples can be browsed directly on `Github <https://github.com/nbara/python-meegkit/tree/master/examples>`_.

2 changes: 1 addition & 1 deletion meegkit/cca.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""CCA functions."""
"""Canonical Correlation Analysis."""
import numpy as np
from scipy import linalg

Expand Down
4 changes: 3 additions & 1 deletion meegkit/ress.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
def RESS(X, sfreq: int, peak_freq: float, neig_freq: float = 1,
peak_width: float = .5, neig_width: float = 1, n_keep: int = 1,
return_maps: bool = False):
"""Rhythmic entrainment source separation [1]_.
"""Rhythmic Entrainment Source Separation.

As described in [1]_.

Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions meegkit/trca.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Task-Related Component Analysis (TRCA)."""
"""Task-Related Component Analysis."""
# Author: Giuseppe Ferraro <giuseppe.ferraro@isae-supaero.fr>
import numpy as np
import scipy.linalg as linalg
Expand All @@ -8,7 +8,7 @@


def trca(X):
"""Task-related component analysis (TRCA).
"""Task-related component analysis.

This function implements the method described in [1]_.

Expand Down
6 changes: 4 additions & 2 deletions meegkit/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def cronbach(epochs, K=None, n_bootstrap=2000, tmin=None, tmax=None):
Internal reliability of the ERN and Pe as a function of increasing trial
numbers can be quantified with Cronbach's alpha:

$$\alpha = \frac{K}{K-1} \left(1-\frac{\sum_{i=1}^K
\sigma^2_{Y_i}}{ \sigma^2_X}\right)$$
$$\alpha = \frac{K}{K-1} \left(1-\frac{\sum_{i=1}^K
\sigma^2_{Y_i}}{ \sigma^2_X}\right)$$

Hinton, Brownlow, McMurray, and Cozens (2004) have suggested that
Cronbach's alpha exceeding .90 indicates excellent internal reliability,
Expand Down Expand Up @@ -284,6 +284,8 @@ def cronbach(epochs, K=None, n_bootstrap=2000, tmin=None, tmax=None):
def snr_spectrum(X, freqs, n_avg=1, n_harm=1, skipbins=1):
"""Compute Signal-to-Noise-corrected spectrum.

The implementation tries to replicate examples in [1; 2; 3]_.

Parameters
----------
X : ndarray , shape=(n_freqs, n_chans,[ n_trials,])
Expand Down
8 changes: 5 additions & 3 deletions meegkit/utils/trca.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def normfit(data, ci=0.95):

Parameters
----------
data: array, shape=()
data : array, shape=()
Input data.
ci : float
Confidence interval (default=0.95).
Expand Down Expand Up @@ -61,8 +61,10 @@ def normfit(data, ci=0.95):
def itr(n, p, t):
"""Compute information transfer rate (ITR).

Inputs
------
Definition in [1]_.

Parameters
----------
n : int
Number of targets.
p : float
Expand Down
4 changes: 0 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ scipy
matplotlib
scikit-learn
pandas
sphinx
pillow
sphinx-gallery
joblib
numpydoc
flake8
pytest
pytest-cov
Expand Down