Skip to content

Commit 501ef5c

Browse files
authored
[MAINT] Move to pyproject.toml (#68)
1 parent 12c348c commit 501ef5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1077
-863
lines changed

Makefile

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,32 @@ pydocstyle:
6060
@pydocstyle
6161

6262
pep:
63-
@$(MAKE) -k flake pydocstyle codespell-error
64-
65-
flake:
66-
@if command -v flake8 > /dev/null; then \
67-
echo "Running flake8"; \
68-
flake8 --count meegkit examples; \
69-
else \
70-
echo "flake8 not found, please install it!"; \
71-
exit 1; \
72-
fi;
73-
@echo "flake8 passed"
63+
@$(MAKE) -k ruff codespell
7464

75-
# Tests
65+
ruff:
66+
@ruff check $(CODESPELL_DIRS)
67+
68+
ruff-fix:
69+
@ruff check $(CODESPELL_DIRS) --fix
70+
71+
# Build and install
7672
# =============================================================================
77-
# test:
78-
# py.test tests
73+
install-requirements:
74+
@echo "Checking/Installing requirements..."
75+
@pip install -q -r requirements.in
76+
77+
install:
78+
@echo "Installing package..."
79+
@pip install -q --no-deps .
80+
@echo "\x1b[1m\x1b[32m * Package successfully installed! \x1b[0m"
81+
82+
install-dev:
83+
@echo "Installing package in editable mode..."
84+
@pip install -q -e ".[docs, tests]" --config-settings editable_mode=compat
85+
@echo "\x1b[1m\x1b[32m * Package successfully installed! \x1b[0m"
7986

87+
# Tests
88+
# =============================================================================
8089
test: in
8190
rm -f .coverage
8291
$(PYTESTS) -m 'not ultraslowtest' meegkit
@@ -94,3 +103,6 @@ test-full: in
94103
$(PYTESTS) meegkit
95104

96105
.PHONY: init test
106+
107+
108+

README.md

Lines changed: 69 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@
55
[![DOI](https://zenodo.org/badge/117451752.svg)](https://zenodo.org/badge/latestdoi/117451752)
66
[![twitter](https://img.shields.io/twitter/follow/lebababa?style=flat&logo=Twitter)](https://twitter.com/intent/follow?screen_name=lebababa)
77

8-
# MEEGkit
8+
# `MEEGkit`
99

10-
Denoising tools for M/EEG processing in Python 3.7+.
10+
Denoising tools for M/EEG processing in Python 3.8+.
1111

1212
![meegkit-ERP](https://user-images.githubusercontent.com/10333715/176754293-eaa35071-94f8-40dd-a487-9f8103c92571.png)
1313

14-
> **Disclaimer:** The project mostly consists of development code, although some modules and functions are already working. Bugs and performance problems are to be expected, so use at your own risk. More tests and improvements will be added in the future. Comments and suggestions are welcome.
14+
> **Disclaimer:** The project mostly consists of development code, although some modules
15+
and functions are already working. Bugs and performance problems are to be expected, so
16+
use at your own risk. More tests and improvements will be added in the future. Comments
17+
and suggestions are welcome.
1518

1619
## Documentation
1720

1821
Automatic documentation is [available online](https://nbara.github.io/python-meegkit/).
1922

20-
This code can also be tested directly from your browser using [Binder](https://mybinder.org), by clicking on the binder badge above.
23+
This code can also be tested directly from your browser using
24+
[Binder](https://mybinder.org), by clicking on the binder badge above.
2125

2226
## Installation
2327

@@ -27,18 +31,21 @@ This package can be installed easily using `pip`:
2731
pip install meegkit
2832
```
2933

30-
Or you can clone this repository and run the following commands inside the `python-meegkit` directory:
34+
Or you can clone this repository and run the following commands inside the
35+
`python-meegkit` directory:
3136

3237
```bash
3338
pip install -r requirements.txt
3439
pip install .
3540
```
3641

37-
*Note* : Use developer mode with the `-e` flag (`pip install -e .`) to be able to modify the sources even after install.
42+
*Note* : Use developer mode with the `-e` flag (`pip install -e .`) to be able to modify
43+
the sources even after install.
3844

3945
### Advanced installation instructions
4046

41-
Some ASR variants require additional dependencies such as `pymanopt`. To install meegkit with these optional packages, use:
47+
Some ASR variants require additional dependencies such as `pymanopt`. To install meegkit
48+
with these optional packages, use:
4249

4350
```bash
4451
pip install -e '.[extra]'
@@ -50,90 +57,95 @@ or:
5057
pip install meegkit[extra]
5158
```
5259

53-
Other available options are `[docs]` (which installs dependencies required to build the documentation), or `[tests]` (which install dependencies to run unit tests).
60+
Other available options are `[docs]` (which installs dependencies required to build the
61+
documentation), or `[tests]` (which install dependencies to run unit tests).
5462

5563
## References
5664

57-
### 1. CCA, STAR, SNS, DSS, ZapLine, and Robust Detrending
65+
If you use this code, you should cite the relevant methods from the original articles.
5866

59-
This is mostly a translation of Matlab code from the [NoiseTools toolbox](http://audition.ens.fr/adc/NoiseTools/) by Alain de Cheveigné. It builds on an initial python implementation by [Pedro Alcocer](https://github.com/pealco).
67+
### 1. CCA, STAR, SNS, DSS, ZapLine, and Robust Detrending
6068

61-
Only CCA, SNS, DSS, STAR, ZapLine and robust detrending have been properly tested so far. TSCPA may give inaccurate results due to insufficient testing (contributions welcome!)
69+
This is mostly a translation of Matlab code from the
70+
[NoiseTools toolbox](http://audition.ens.fr/adc/NoiseTools/) by Alain de Cheveigné.
71+
It builds on an initial python implementation by
72+
[Pedro Alcocer](https://github.com/pealco).
6273

63-
If you use this code, you should cite the relevant methods from the original articles:
74+
Only CCA, SNS, DSS, STAR, ZapLine and robust detrending have been properly tested so far.
75+
TSCPA may give inaccurate results due to insufficient testing (contributions welcome!)
6476

6577
```sql
66-
[1] de Cheveigné, A. (2019). ZapLine: A simple and effective method to remove power line artifacts.
67-
NeuroImage, 116356. https://doi.org/10.1016/j.neuroimage.2019.116356
68-
[2] de Cheveigné, A. et al. (2019). Multiway canonical correlation analysis of brain data.
69-
NeuroImage, 186, 728740. https://doi.org/10.1016/j.neuroimage.2018.11.026
70-
[3] de Cheveigné, A. et al. (2018). Decoding the auditory brain with canonical component analysis.
71-
NeuroImage, 172, 206216. https://doi.org/10.1016/j.neuroimage.2018.01.033
72-
[4] de Cheveigné, A. (2016). Sparse time artifact removal.
73-
Journal of Neuroscience Methods, 262, 1420. https://doi.org/10.1016/j.jneumeth.2016.01.005
74-
[5] de Cheveigné, A., & Parra, L. C. (2014). Joint decorrelation, a versatile tool for multichannel
75-
data analysis. NeuroImage, 98, 487505. https://doi.org/10.1016/j.neuroimage.2014.05.068
76-
[6] de Cheveigné, A. (2012). Quadratic component analysis.
77-
NeuroImage, 59(4), 38383844. https://doi.org/10.1016/j.neuroimage.2011.10.084
78-
[7] de Cheveigné, A. (2010). Time-shift denoising source separation.
79-
Journal of Neuroscience Methods, 189(1), 113120. https://doi.org/10.1016/j.jneumeth.2010.03.002
78+
[1] de Cheveigné, A. (2019). ZapLine: A simple and effective method to remove power line
79+
artifacts. NeuroImage, 116356. https://doi.org/10.1016/j.neuroimage.2019.116356
80+
[2] de Cheveigné, A. et al. (2019). Multiway canonical correlation analysis of brain
81+
data. NeuroImage, 186, 728740. https://doi.org/10.1016/j.neuroimage.2018.11.026
82+
[3] de Cheveigné, A. et al. (2018). Decoding the auditory brain with canonical component
83+
analysis. NeuroImage, 172, 206216. https://doi.org/10.1016/j.neuroimage.2018.01.033
84+
[4] de Cheveigné, A. (2016). Sparse time artifact removal. Journal of Neuroscience
85+
Methods, 262, 1420. https://doi.org/10.1016/j.jneumeth.2016.01.005
86+
[5] de Cheveigné, A., & Parra, L. C. (2014). Joint decorrelation, a versatile tool for
87+
multichannel data analysis. NeuroImage, 98, 487505.
88+
https://doi.org/10.1016/j.neuroimage.2014.05.068
89+
[6] de Cheveigné, A. (2012). Quadratic component analysis. NeuroImage, 59(4), 38383844.
90+
https://doi.org/10.1016/j.neuroimage.2011.10.084
91+
[7] de Cheveigné, A. (2010). Time-shift denoising source separation. Journal of
92+
Neuroscience Methods, 189(1), 113120. https://doi.org/10.1016/j.jneumeth.2010.03.002
8093
[8] de Cheveigné, A., & Simon, J. Z. (2008a). Denoising based on spatial filtering.
81-
Journal of Neuroscience Methods, 171(2), 331339. https://doi.org/10.1016/j.jneumeth.2008.03.015
82-
[9] de Cheveigné, A., & Simon, J. Z. (2008b). Sensor noise suppression.
83-
Journal of Neuroscience Methods, 168(1), 195202. https://doi.org/10.1016/j.jneumeth.2007.09.012
94+
Journal of Neuroscience Methods, 171(2), 331339.
95+
https://doi.org/10.1016/j.jneumeth.2008.03.015
96+
[9] de Cheveigné, A., & Simon, J. Z. (2008b). Sensor noise suppression. Journal of
97+
Neuroscience Methods, 168(1), 195202. https://doi.org/10.1016/j.jneumeth.2007.09.012
8498
[10] de Cheveigné, A., & Simon, J. Z. (2007). Denoising based on time-shift PCA.
85-
Journal of Neuroscience Methods, 165(2), 297305. https://doi.org/10.1016/j.jneumeth.2007.06.003
99+
Journal of Neuroscience Methods, 165(2), 297305.
100+
https://doi.org/10.1016/j.jneumeth.2007.06.003
86101
```
87102

88103
### 2. Artifact Subspace Reconstruction (ASR)
89104

90-
The base code is inspired from the original [EEGLAB inplementation](https://github.com/sccn/clean_rawdata) [1], while the riemannian variant [2] was adapted from the [rASR toolbox](https://github.com/s4rify/rASRMatlab) by Sarah Blum.
91-
92-
If you use this code, you should cite the relevant methods from the original articles:
105+
The base code is inspired from the original
106+
[EEGLAB inplementation](https://github.com/sccn/clean_rawdata) [1], while the Riemannian
107+
variant [2] was adapted from the [rASR toolbox](https://github.com/s4rify/rASRMatlab) by
108+
Sarah Blum.
93109

94110
```sql
95-
[1] Mullen, T. R., Kothe, C. A. E., Chi, Y. M., Ojeda, A., Kerth, T., Makeig, S., et al. (2015).
96-
Real-time neuroimaging and cognitive monitoring using wearable dry EEG. IEEE Trans. Bio-Med.
97-
Eng. 62, 25532567. https://doi.org/10.1109/TBME.2015.2481482
98-
[2] Blum, S., Jacobsen, N., Bleichner, M. G., & Debener, S. (2019). A Riemannian modification of
99-
artifact subspace reconstruction for EEG artifact handling. Frontiers in human neuroscience,
100-
13, 141.
111+
[1] Mullen, T. R., Kothe, C. A. E., Chi, Y. M., Ojeda, A., Kerth, T., Makeig, S.,
112+
et al. (2015). Real-time neuroimaging and cognitive monitoring using wearable dry
113+
EEG. IEEE Trans. Bio-Med. Eng. 62, 25532567.
114+
https://doi.org/10.1109/TBME.2015.2481482
115+
[2] Blum, S., Jacobsen, N., Bleichner, M. G., & Debener, S. (2019). A Riemannian
116+
modification of artifact subspace reconstruction for EEG artifact handling. Frontiers
117+
in human neuroscience, 13, 141.
101118
```
102119

103120
### 3. Rhythmic Entrainment Source Separation (RESS)
104121

105122
The code is based on [Matlab code from Mike X. Cohen](https://mikexcohen.com/data/) [1]
106123

107-
If you use this, you should cite the following article:
108-
109124
```sql
110-
[1] Cohen, M. X., & Gulbinaite, R. (2017). Rhythmic entrainment source separation: Optimizing analyses
111-
of neural responses to rhythmic sensory stimulation. Neuroimage, 147, 43-56.
125+
[1] Cohen, M. X., & Gulbinaite, R. (2017). Rhythmic entrainment source separation:
126+
Optimizing analyses of neural responses to rhythmic sensory stimulation. Neuroimage,
127+
147, 43-56.
112128
```
113129

114130
### 4. Task-Related Component Analysis (TRCA)
115131

116-
This code is based on the [Matlab implementation from Masaki Nakanishi](https://github.com/mnakanishi/TRCA-SSVEP), and was adapted to python by [Giuseppe Ferraro](mailto:[email protected])
117-
118-
If you use this, you should cite the following articles:
132+
This code is based on the [Matlab implementation from Masaki Nakanishi](https://github.com/mnakanishi/TRCA-SSVEP),
133+
and was adapted to python by [Giuseppe Ferraro](mailto:[email protected])
119134

120135
```sql
121136
[1] M. Nakanishi, Y. Wang, X. Chen, Y.-T. Wang, X. Gao, and T.-P. Jung,
122-
"Enhancing detection of SSVEPs for a high-speed brain speller using
123-
task-related component analysis", IEEE Trans. Biomed. Eng, 65(1): 104-112,
124-
2018.
125-
[2] X. Chen, Y. Wang, S. Gao, T. -P. Jung and X. Gao, "Filter bank
126-
canonical correlation analysis for implementing a high-speed SSVEP-based
127-
brain-computer interface", J. Neural Eng., 12: 046008, 2015.
128-
[3] X. Chen, Y. Wang, M. Nakanishi, X. Gao, T. -P. Jung, S. Gao,
129-
"High-speed spelling with a noninvasive brain-computer interface",
130-
Proc. Int. Natl. Acad. Sci. U. S. A, 112(44): E6058-6067, 2015.
137+
"Enhancing detection of SSVEPs for a high-speed brain speller using task-related
138+
component analysis", IEEE Trans. Biomed. Eng, 65(1): 104-112, 2018.
139+
[2] X. Chen, Y. Wang, S. Gao, T. -P. Jung and X. Gao, "Filter bank canonical correlation
140+
analysis for implementing a high-speed SSVEP-based brain-computer interface",
141+
J. Neural Eng., 12: 046008, 2015.
142+
[3] X. Chen, Y. Wang, M. Nakanishi, X. Gao, T. -P. Jung, S. Gao, "High-speed spelling
143+
with a noninvasive brain-computer interface", Proc. Int. Natl. Acad. Sci. U.S.A,
144+
112(44): E6058-6067, 2015.
131145
```
132146

133147
### 5. Local Outlier Factor (LOF)
134148

135-
If you use this, you should cite the following article:
136-
137149
```sql
138150
[1] Breunig M, Kriegel HP, Ng RT, Sander J. 2000. LOF: identifying density-based
139151
local outliers. SIGMOD Rec. 29, 2, 93-104. https://doi.org/10.1145/335191.335388

citation.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors:
55
given-names: "Nicolas"
66
orcid: "https://orcid.org/0000-0003-1495-561X"
77
title: "MEEGkit"
8-
version: 0.1.3
8+
version: 0.1.4
99
doi: 10.5281/zenodo.5643659
1010
date-released: 2021-10-15
1111
url: "https://github.com/nbara/python-meegkit"

doc/_static/logo-dark.png

130 KB
Loading

doc/_static/logo.png

140 KB
Loading

doc/conf.py

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@
1212
#
1313
import os
1414
import sys
15-
import matplotlib
16-
matplotlib.use('agg')
15+
16+
import matplotlib as mpl
17+
18+
mpl.use("agg")
1719

1820
curdir = os.path.dirname(__file__)
19-
sys.path.append(os.path.abspath(os.path.join(curdir, '..')))
20-
sys.path.append(os.path.abspath(os.path.join(curdir, '..', 'meegkit')))
21+
sys.path.append(os.path.abspath(os.path.join(curdir, "..")))
22+
sys.path.append(os.path.abspath(os.path.join(curdir, "..", "meegkit")))
2123

2224
import meegkit # noqa
2325

2426
# -- Project information -----------------------------------------------------
2527

26-
project = 'MEEGkit'
27-
copyright = '2022, Nicolas Barascud'
28-
author = 'Nicolas Barascud'
28+
project = "MEEGkit"
29+
copyright = "2023, Nicolas Barascud"
30+
author = "Nicolas Barascud"
2931
release = meegkit.__version__
3032
version = meegkit.__version__
3133

@@ -35,31 +37,31 @@
3537
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3638
# ones.
3739
extensions = [
38-
'sphinx.ext.autodoc',
39-
'sphinx.ext.autosummary',
40-
'sphinx.ext.napoleon',
41-
'numpydoc',
42-
'jupyter_sphinx',
43-
'sphinx_gallery.gen_gallery',
44-
'sphinxemoji.sphinxemoji',
40+
"sphinx.ext.autodoc",
41+
"sphinx.ext.autosummary",
42+
"sphinx.ext.napoleon",
43+
"numpydoc",
44+
"jupyter_sphinx",
45+
"sphinx_gallery.gen_gallery",
46+
"sphinxemoji.sphinxemoji",
4547
]
4648

4749
# Add any paths that contain templates here, relative to this directory.
48-
templates_path = ['_templates']
50+
templates_path = ["_templates"]
4951

5052
# List of patterns, relative to source directory, that match files and
5153
# directories to ignore when looking for source files.
5254
# This pattern also affects html_static_path and html_extra_path.
53-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'config.py']
55+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "config.py"]
5456

5557
# generate autosummary even if no references
5658
# autosummary_generate = True
5759
autodoc_default_options = {
58-
'members': True,
59-
'special-members': '__init__',
60-
'undoc-members': True,
61-
'show-inheritance': True,
62-
'exclude-members': '__weakref__'
60+
"members": True,
61+
"special-members": "__init__",
62+
"undoc-members": True,
63+
"show-inheritance": True,
64+
"exclude-members": "__weakref__"
6365
}
6466
numpydoc_show_class_members = True
6567

@@ -75,15 +77,19 @@
7577
# -- Options for HTML output -------------------------------------------------
7678

7779
# The theme to use for HTML and HTML Help pages
78-
html_theme = 'pydata_sphinx_theme'
80+
html_theme = "pydata_sphinx_theme"
7981

8082
# Add any paths that contain custom static files (such as style sheets) here,
8183
# relative to this directory. They are copied after the builtin static files,
8284
# so a file named "default.css" will overwrite the builtin "default.css".
83-
html_static_path = ['_static']
84-
85+
html_static_path = ["_static"]
8586

8687
html_theme_options = {
88+
"logo": {
89+
"image_light": "_static/logo.png",
90+
"image_dark": "_static/logo-dark.png",
91+
"text": "meegkit",
92+
},
8793
"show_toc_level": 1,
8894
"external_links": [
8995
{
@@ -95,12 +101,12 @@
95101
{
96102
"name": "GitHub",
97103
"url": "https://github.com/nbara/python-meegkit",
98-
"icon": "fab fa-github-square",
104+
"icon": "fa-brands fa-github",
99105
},
100106
{
101107
"name": "Twitter",
102108
"url": "https://twitter.com/lebababa",
103-
"icon": "fab fa-twitter-square",
109+
"icon": "fa-brands fa-twitter",
104110
},
105111
],
106112
"use_edit_page_button": True,
@@ -116,10 +122,10 @@
116122
# -- Options for Sphinx-gallery HTML ------------------------------------------
117123

118124
sphinx_gallery_conf = {
119-
'doc_module': ('meegkit',),
120-
'examples_dirs': '../examples', # path to your example scripts
121-
'gallery_dirs': 'auto_examples', # path to where to save gallery generated output
122-
'filename_pattern': '/example_',
123-
'ignore_pattern': 'config.py',
124-
'run_stale_examples': False,
125+
"doc_module": ("meegkit",),
126+
"examples_dirs": "../examples", # path to your example scripts
127+
"gallery_dirs": "auto_examples", # path to where to save gallery generated output
128+
"filename_pattern": "/example_",
129+
"ignore_pattern": "config.py",
130+
"run_stale_examples": False,
125131
}

0 commit comments

Comments
 (0)