eegprep 0.2.22__tar.gz → 0.2.23__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. {eegprep-0.2.22/src/eegprep.egg-info → eegprep-0.2.23}/PKG-INFO +35 -8
  2. {eegprep-0.2.22 → eegprep-0.2.23}/README.md +20 -5
  3. {eegprep-0.2.22 → eegprep-0.2.23}/pyproject.toml +17 -5
  4. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/ICL_feature_extractor.py +17 -0
  5. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/__init__.py +4 -0
  6. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/bids_list_eeg_files.py +7 -9
  7. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/bids_preproc.py +107 -91
  8. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/clean_artifacts.py +72 -70
  9. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/clean_asr.py +16 -9
  10. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/clean_channels.py +19 -17
  11. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/clean_channels_nolocs.py +6 -4
  12. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/clean_drifts.py +6 -4
  13. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/clean_flatlines.py +5 -3
  14. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/clean_windows.py +7 -2
  15. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_autocorr.py +17 -0
  16. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_autocorr_fftw.py +21 -1
  17. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_autocorr_welch.py +21 -0
  18. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_checkset.py +15 -8
  19. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_compare.py +24 -1
  20. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_decodechan.py +20 -9
  21. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_eeg2mne.py +15 -1
  22. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_eegrej.py +38 -18
  23. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_findboundaries.py +3 -1
  24. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_interp.py +79 -21
  25. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_lat2point.py +5 -3
  26. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_mne2eeg.py +16 -3
  27. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_mne2eeg_epochs.py +17 -1
  28. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_options.py +6 -4
  29. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_picard.py +3 -2
  30. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_point2lat.py +11 -7
  31. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeg_rpsd.py +19 -0
  32. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eeglabcompat.py +94 -14
  33. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eegobj.py +16 -9
  34. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/eegrej.py +24 -15
  35. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/epoch.py +10 -3
  36. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/iclabel.py +9 -8
  37. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/iclabel_net.py +149 -6
  38. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/iclabel_net_load_py_measures.py +19 -6
  39. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pinv.py +5 -4
  40. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_epoch.py +65 -7
  41. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_load_frombids.py +49 -34
  42. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_loadset.py +21 -1
  43. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_loadset_h5.py +14 -0
  44. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_reref.py +16 -0
  45. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_reref_helper.py +2 -0
  46. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_resample.py +80 -45
  47. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_rmbase.py +7 -8
  48. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_saveset.py +76 -9
  49. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pop_select.py +8 -5
  50. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/pymat.py +11 -3
  51. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/redefine_functions.py +30 -8
  52. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/save_struct_as_hdf5.py +13 -0
  53. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/topoplot.py +42 -10
  54. eegprep-0.2.23/src/eegprep/utils/__init__.py +4 -0
  55. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/asr.py +9 -5
  56. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/bids.py +38 -26
  57. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/coords.py +40 -23
  58. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/covariance.py +5 -5
  59. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/git.py +7 -5
  60. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/logs.py +16 -10
  61. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/misc.py +84 -52
  62. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/ransac.py +12 -8
  63. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/sigproc.py +194 -128
  64. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/spatial.py +11 -7
  65. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/stats.py +14 -8
  66. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/utils/testing.py +8 -6
  67. {eegprep-0.2.22 → eegprep-0.2.23/src/eegprep.egg-info}/PKG-INFO +35 -8
  68. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep.egg-info/SOURCES.txt +1 -0
  69. eegprep-0.2.23/src/eegprep.egg-info/requires.txt +37 -0
  70. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_bids_preproc.py +5 -0
  71. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_clean_rawdata.py +11 -3
  72. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_autocorr.py +2 -0
  73. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_compare.py +2 -0
  74. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_eeg2mne.py +33 -17
  75. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_eegrej.py +1 -0
  76. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_interp.py +4 -0
  77. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_lat2point.py +2 -0
  78. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_mne2eeg.py +12 -1
  79. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_mne2eeg_epochs.py +37 -32
  80. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_picard.py +1 -0
  81. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_point2lat.py +2 -0
  82. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eegfindboundaries.py +5 -1
  83. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeglabcompat.py +5 -0
  84. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eegobj.py +6 -4
  85. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eegrej.py +3 -1
  86. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_epoch.py +2 -0
  87. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_fixtures.py +31 -14
  88. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_iclabel.py +1 -0
  89. eegprep-0.2.23/tests/test_matlab_path.py +97 -0
  90. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pinv.py +2 -0
  91. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pipeline.py +2 -0
  92. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pop_epoch.py +6 -1
  93. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pop_loadset_h5.py +8 -1
  94. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pop_reref.py +13 -9
  95. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pop_resample.py +5 -1
  96. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pop_rmbase.py +14 -2
  97. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pop_select.py +2 -0
  98. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_utils_testing.py +1 -1
  99. eegprep-0.2.22/src/eegprep/utils/__init__.py +0 -2
  100. eegprep-0.2.22/src/eegprep.egg-info/requires.txt +0 -24
  101. {eegprep-0.2.22 → eegprep-0.2.23}/LICENSE +0 -0
  102. {eegprep-0.2.22 → eegprep-0.2.23}/setup.cfg +0 -0
  103. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/netICL.mat +0 -0
  104. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/eeg_options_64bit.m +0 -0
  105. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/README.md +0 -0
  106. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/biosemi-128.locs +0 -0
  107. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/biosemi-sccn-128v1.locs +0 -0
  108. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/biosemi-sccn-128v2.locs +0 -0
  109. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/biosemi-sccn-256v1.locs +0 -0
  110. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/egi-gsn-hydrocell-129.locs +0 -0
  111. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/egi-gsn-hydrocell-257.locs +0 -0
  112. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep/resources/montages/standard-10-5-342ch.locs +0 -0
  113. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep.egg-info/dependency_links.txt +0 -0
  114. {eegprep-0.2.22 → eegprep-0.2.23}/src/eegprep.egg-info/top_level.txt +0 -0
  115. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_ICL_feature_extractor.py +0 -0
  116. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_bids_preproc_old.py +0 -0
  117. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_clean_artifacts.py +0 -0
  118. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_clean_asr.py +0 -0
  119. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_clean_drifts.py +0 -0
  120. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_clean_flatlines.py +0 -0
  121. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_clean_windows.py +0 -0
  122. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_autocorr_fftw.py +0 -0
  123. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_autocorr_welch.py +0 -0
  124. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_eeg_decodechan.py +0 -0
  125. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_import_edf.py +0 -0
  126. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_logs.py +0 -0
  127. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pop_saveset.py +0 -0
  128. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_pymat.py +0 -0
  129. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_spatial.py +0 -0
  130. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_topoplot.py +0 -0
  131. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_utils_asr.py +0 -0
  132. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_utils_covariance.py +0 -0
  133. {eegprep-0.2.22 → eegprep-0.2.23}/tests/test_utils_ransac.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eegprep
3
- Version: 0.2.22
3
+ Version: 0.2.23
4
4
  Summary: EEG preprocessing pipeline on Python
5
5
  Author-email: Arnaud Delorme <adelorme@gmail.com>, Young Truong <dt.young112@gmail.com>
6
6
  License: BSD 2-Clause License
@@ -46,7 +46,7 @@ Requires-Dist: h5py>=3.3.0
46
46
  Requires-Dist: matplotlib>=3.4.0
47
47
  Requires-Dist: mne>=1.10.0
48
48
  Requires-Dist: neo>=0.14.2
49
- Requires-Dist: numpy<2
49
+ Requires-Dist: numpy>=1.20
50
50
  Requires-Dist: oct2py>=5.5.0
51
51
  Requires-Dist: psutil>=7.0.0
52
52
  Requires-Dist: pybids>=0.4
@@ -59,15 +59,32 @@ Provides-Extra: torch
59
59
  Requires-Dist: torch>=2.5.1; extra == "torch"
60
60
  Provides-Extra: eeglabio
61
61
  Requires-Dist: eeglabio>=0.1.2; extra == "eeglabio"
62
+ Provides-Extra: docs
63
+ Requires-Dist: sphinx>=7.0; extra == "docs"
64
+ Requires-Dist: pydata-sphinx-theme>=0.14.0; extra == "docs"
65
+ Requires-Dist: sphinx-gallery>=0.14.0; extra == "docs"
66
+ Requires-Dist: sphinx-autodoc-typehints>=1.25.0; extra == "docs"
67
+ Requires-Dist: numpydoc>=1.6.0; extra == "docs"
68
+ Requires-Dist: sphinx-design>=0.5.0; extra == "docs"
69
+ Requires-Dist: myst-parser>=1.0.0; extra == "docs"
70
+ Requires-Dist: sphinx-copybutton>=0.5.0; extra == "docs"
71
+ Requires-Dist: sphinx-togglebutton>=0.3.0; extra == "docs"
72
+ Requires-Dist: sphinxcontrib-spelling>=7.1.0; extra == "docs"
62
73
  Provides-Extra: all
63
- Requires-Dist: torch>=2.5.1; extra == "all"
64
- Requires-Dist: eeglabio>=0.1.2; extra == "all"
74
+ Requires-Dist: eegprep[torch]; extra == "all"
75
+ Requires-Dist: eegprep[eeglabio]; extra == "all"
76
+ Requires-Dist: eegprep[docs]; extra == "all"
65
77
  Dynamic: license-file
66
78
 
67
79
  # EEGPrep
68
80
 
81
+ [![Documentation Status](https://github.com/sccn/eegprep/actions/workflows/docs.yml/badge.svg)](https://github.com/sccn/eegprep/actions/workflows/docs.yml)
82
+ [![GitHub Pages](https://github.com/sccn/eegprep/actions/workflows/pages.yml/badge.svg)](https://sccn.github.io/eegprep/)
83
+
69
84
  EEGPrep is a Python package that reproduces the EEGLAB default preprocessing pipeline with numerical accuracy down to 1e-5 uV, including clean_rawdata and ICLabel, enabling MATLAB-to-Python equivalence for EEG analysis. It takes BIDS data as input and produces BIDS derivative dataset as output, which can then be reimported into other packages as needed (EEGLAB, Fieldtrip, Brainstorm, MNE). It does produce plots. The package will be fully documented for conversion, packaging, and testing workflows, with installation available via PyPI.
70
85
 
86
+ **📚 [View Full Documentation](https://sccn.github.io/eegprep/)** | **🔧 [GitHub Pages Setup Guide](docs/GITHUB_PAGES_SETUP.md)**
87
+
71
88
  ## Pre-Release
72
89
 
73
90
  EEGPrep is currently in a pre-release phase. It functions end-to-end (bids branch) but has not yet been tested with multiple BIDS datasets. The documentation is incomplete, and use is at your own risk. The planned release is scheduled for the end of 2025.
@@ -104,9 +121,9 @@ The MATLAB and Python implementations were compared using the first two subjects
104
121
  # Docker (SCCN Power Users)
105
122
 
106
123
  ```
107
- docker build -t eegprep:0.2.6 -f DOCKERFILE .
108
- docker tag eegprep:0.2.6 arnodelorme/eegprep:0.2.6
109
- docker push arnodelorme/eegprep:0.2.6
124
+ docker build -t eegprep:0.2.9 -f DOCKERFILE .
125
+ docker tag eegprep:0.2.9 arnodelorme/eegprep:0.2.9
126
+ docker push arnodelorme/eegprep:0.2.9
110
127
  ```
111
128
 
112
129
  Check the project on https://hub.docker.com/
@@ -192,7 +209,17 @@ pip install eegprep[all]
192
209
 
193
210
  ## Running Tests
194
211
 
195
- Install MATLAB interface `pip install /your/path/to/matlab/extern/engines/python`
212
+ Install MATLAB interface `pip install /your/path/to/matlab/extern/engines/python` (for example on OSx `pip install /Applications/MATLAB_R2025a.app/extern/engines/python
213
+ Processing /Applications/MATLAB_R2025a.app/extern/engines/python`)
214
+
215
+ Check installation
216
+
217
+ ```python
218
+ import matlab.engine
219
+ engine = matlab.engine.start_matlab()
220
+ engine.eval("disp('hello world');", nargout=0)
221
+ ```
222
+
196
223
  Use tests/main_compare.m
197
224
 
198
225
  This project uses `unittest`. You can run tests from the project root via the command:
@@ -1,7 +1,12 @@
1
1
  # EEGPrep
2
2
 
3
+ [![Documentation Status](https://github.com/sccn/eegprep/actions/workflows/docs.yml/badge.svg)](https://github.com/sccn/eegprep/actions/workflows/docs.yml)
4
+ [![GitHub Pages](https://github.com/sccn/eegprep/actions/workflows/pages.yml/badge.svg)](https://sccn.github.io/eegprep/)
5
+
3
6
  EEGPrep is a Python package that reproduces the EEGLAB default preprocessing pipeline with numerical accuracy down to 1e-5 uV, including clean_rawdata and ICLabel, enabling MATLAB-to-Python equivalence for EEG analysis. It takes BIDS data as input and produces BIDS derivative dataset as output, which can then be reimported into other packages as needed (EEGLAB, Fieldtrip, Brainstorm, MNE). It does produce plots. The package will be fully documented for conversion, packaging, and testing workflows, with installation available via PyPI.
4
7
 
8
+ **📚 [View Full Documentation](https://sccn.github.io/eegprep/)** | **🔧 [GitHub Pages Setup Guide](docs/GITHUB_PAGES_SETUP.md)**
9
+
5
10
  ## Pre-Release
6
11
 
7
12
  EEGPrep is currently in a pre-release phase. It functions end-to-end (bids branch) but has not yet been tested with multiple BIDS datasets. The documentation is incomplete, and use is at your own risk. The planned release is scheduled for the end of 2025.
@@ -38,9 +43,9 @@ The MATLAB and Python implementations were compared using the first two subjects
38
43
  # Docker (SCCN Power Users)
39
44
 
40
45
  ```
41
- docker build -t eegprep:0.2.6 -f DOCKERFILE .
42
- docker tag eegprep:0.2.6 arnodelorme/eegprep:0.2.6
43
- docker push arnodelorme/eegprep:0.2.6
46
+ docker build -t eegprep:0.2.9 -f DOCKERFILE .
47
+ docker tag eegprep:0.2.9 arnodelorme/eegprep:0.2.9
48
+ docker push arnodelorme/eegprep:0.2.9
44
49
  ```
45
50
 
46
51
  Check the project on https://hub.docker.com/
@@ -126,7 +131,17 @@ pip install eegprep[all]
126
131
 
127
132
  ## Running Tests
128
133
 
129
- Install MATLAB interface `pip install /your/path/to/matlab/extern/engines/python`
134
+ Install MATLAB interface `pip install /your/path/to/matlab/extern/engines/python` (for example on OSx `pip install /Applications/MATLAB_R2025a.app/extern/engines/python
135
+ Processing /Applications/MATLAB_R2025a.app/extern/engines/python`)
136
+
137
+ Check installation
138
+
139
+ ```python
140
+ import matlab.engine
141
+ engine = matlab.engine.start_matlab()
142
+ engine.eval("disp('hello world');", nargout=0)
143
+ ```
144
+
130
145
  Use tests/main_compare.m
131
146
 
132
147
  This project uses `unittest`. You can run tests from the project root via the command:
@@ -139,4 +154,4 @@ python -m unittest discover -s tests
139
154
 
140
155
  - Arnaud Delorme, UCSD, CA, USA
141
156
  - Christian Kothe, Intheon, CA, USA
142
- - Bruno Aristimunha Pinto, Inria, France
157
+ - Bruno Aristimunha Pinto, Inria, France
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eegprep"
7
- version = "0.2.22"
7
+ version = "0.2.23"
8
8
  authors = [
9
9
  { name="Arnaud Delorme", email="adelorme@gmail.com" },
10
10
  { name="Young Truong", email="dt.young112@gmail.com" },
@@ -28,7 +28,7 @@ dependencies = [
28
28
  "matplotlib>=3.4.0",
29
29
  "mne>=1.10.0",
30
30
  "neo>=0.14.2",
31
- "numpy<2",
31
+ "numpy>=1.20",
32
32
  "oct2py>=5.5.0",
33
33
  "psutil>=7.0.0",
34
34
  "pybids>=0.4",
@@ -46,9 +46,22 @@ torch = [
46
46
  eeglabio = [
47
47
  "eeglabio>=0.1.2"
48
48
  ]
49
+ docs = [
50
+ "sphinx>=7.0",
51
+ "pydata-sphinx-theme>=0.14.0",
52
+ "sphinx-gallery>=0.14.0",
53
+ "sphinx-autodoc-typehints>=1.25.0",
54
+ "numpydoc>=1.6.0",
55
+ "sphinx-design>=0.5.0",
56
+ "myst-parser>=1.0.0",
57
+ "sphinx-copybutton>=0.5.0",
58
+ "sphinx-togglebutton>=0.3.0",
59
+ "sphinxcontrib-spelling>=7.1.0"
60
+ ]
49
61
  all = [
50
- "torch>=2.5.1",
51
- "eeglabio>=0.1.2"
62
+ "eegprep[torch]",
63
+ "eegprep[eeglabio]",
64
+ "eegprep[docs]",
52
65
  ]
53
66
 
54
67
  [tool.setuptools]
@@ -69,7 +82,6 @@ exclude = ["eegprep.eeglab*"]
69
82
  [tool.setuptools.exclude-package-data]
70
83
  "eegprep" = ["eeglab/**"]
71
84
 
72
-
73
85
  [project.urls]
74
86
  Homepage = "https://github.com/sccn/eegprep"
75
87
  Issues = "https://github.com/sccn/eegprep/issues"
@@ -1,7 +1,23 @@
1
+ """ICLabel feature extraction functions."""
2
+
1
3
  from copy import deepcopy
2
4
  import numpy as np
3
5
 
4
6
  def ICL_feature_extractor(EEG, flag_autocorr=False):
7
+ """Extract features for ICLabel classification.
8
+
9
+ Parameters
10
+ ----------
11
+ EEG : dict
12
+ EEG data structure with ICA
13
+ flag_autocorr : bool, optional
14
+ Whether to include autocorrelation features (default False)
15
+
16
+ Returns
17
+ -------
18
+ features : list
19
+ List of feature arrays
20
+ """
5
21
  from eegprep import topoplot
6
22
  from eegprep import eeg_rpsd
7
23
  from eegprep import eeg_autocorr_welch
@@ -87,6 +103,7 @@ def ICL_feature_extractor(EEG, flag_autocorr=False):
87
103
  return features
88
104
 
89
105
  def test_ICL_feature_extractor():
106
+ """Test the ICL_feature_extractor function."""
90
107
  flag_autocorr = True
91
108
  EEG = EEG2
92
109
  EEG['ref'] = 'averef'
@@ -1,5 +1,9 @@
1
+ """EEG preprocessing package for MATLAB EEGLAB compatibility."""
2
+
1
3
  import logging
2
4
 
5
+ __version__ = "0.2.23"
6
+
3
7
  from .utils.logs import setup_logging
4
8
  setup_logging(logging.INFO)
5
9
 
@@ -1,7 +1,7 @@
1
- import os
1
+ """BIDS EEG file listing utilities."""
2
+
2
3
  import logging
3
4
  from typing import List, Sequence
4
- from types import NoneType
5
5
  from eegprep.utils.bids import layout_for_fpath
6
6
 
7
7
  logger = logging.getLogger(__name__)
@@ -18,11 +18,10 @@ def bids_list_eeg_files(
18
18
  runs: Sequence[str | int] | str | int = (),
19
19
  tasks: Sequence[str | int] | str | int = (),
20
20
  ) -> List[str]:
21
- """
22
- Return a list of all EEG raw-data files in a BIDS dataset.
21
+ """Return a list of all EEG raw-data files in a BIDS dataset.
23
22
 
24
- Parameters:
25
- -----------
23
+ Parameters
24
+ ----------
26
25
  root : str
27
26
  The root directory containing BIDS data.
28
27
  subjects : Sequence[str | int], optional
@@ -39,9 +38,8 @@ def bids_list_eeg_files(
39
38
  A sequence of task names or single task to filter the files by. If empty, all
40
39
  tasks are included (default is an empty sequence).
41
40
 
42
- Returns:
43
- --------
44
-
41
+ Returns
42
+ -------
45
43
  List[str]
46
44
  A list of file paths to EEG files in the BIDS dataset.
47
45
  """
@@ -1,3 +1,5 @@
1
+ """Module for BIDS preprocessing of EEG."""
2
+
1
3
  import os
2
4
  import hashlib
3
5
  import json
@@ -62,8 +64,7 @@ def _copy_misc_root_files(root: str, dst: str, exclude: List[str]) -> None:
62
64
 
63
65
 
64
66
  def _legacy_override(new_and_name: Tuple[Any, str], old_and_name: Tuple[Any, str], default: Any):
65
- """Handle overrides with values from legacy parameters and a default if both the new
66
- and legacy parameter are None."""
67
+ """Handle overrides with values from legacy parameters and a default if both the new and legacy parameter are None."""
67
68
  new, new_name = new_and_name
68
69
  old, old_name = old_and_name
69
70
  if old is not None:
@@ -151,195 +152,208 @@ def bids_preproc(
151
152
  _n_jobs: int = 1,
152
153
  _t0: float = now(),
153
154
  ) -> Dict[str,Any] | List[Dict[str, Any]] | None:
154
- """
155
- Apply data cleaning to EEG files in a BIDS dataset.
155
+ """Apply data cleaning to EEG files in a BIDS dataset.
156
156
 
157
- Parameters:
158
- -----------
159
- root_or_fn : str
157
+ Parameters
158
+ ----------
159
+ root : str
160
160
  The root directory containing BIDS data or a single EEG file path.
161
161
 
162
162
  (BIDS import stage parameters)
163
- ApplyMetadata (bool):
163
+
164
+ ApplyMetadata : bool
164
165
  Whether to apply metadata from BIDS sidecar files when loading raw EEG data.
165
166
  (default True)
166
- ApplyEvents (bool):
167
+ ApplyEvents : bool
167
168
  Whether to apply events from BIDS sidecar files when loading raw EEG data.
168
169
  (default False)
169
- ApplyChanlocs (bool):
170
+ ApplyChanlocs : bool
170
171
  Whether to apply channel locations from BIDS sidecar files when loading raw EEG data.
171
172
  (default True)
172
- EventColumn (str):
173
+ EventColumn : str
173
174
  Optionally the column name in the BIDS events file to use for event types; if not
174
175
  set, will be inferred heuristically.
175
- Subjects (Sequence[str | int], optional):
176
+ Subjects : Sequence[str | int], optional
176
177
  A sequence of subject identifiers or (zero-based) indices to filter the files by.
177
178
  If empty, all subjects are included.
178
- Sessions (Sequence[str | int], optional):
179
+ Sessions : Sequence[str | int], optional
179
180
  A sequence of session identifiers or (zero-based) indices to filter the files by.
180
181
  If empty, all sessions are included.
181
- Runs (Sequence[str | int], optional):
182
+ Runs : Sequence[str | int], optional
182
183
  A sequence of run numbers or identifiers to filter the files by. If empty, all runs
183
184
  are included. Note that zero-based indexing does not apply to runs, unlike
184
185
  subjects and sessions since runs are already integers.
185
- Tasks (Sequence[str] | str, optional):
186
+ Tasks : Sequence[str] | str, optional
186
187
  A sequence of task names or single task to filter the files by. If empty, all
187
188
  tasks are included (default is an empty sequence).
188
- OutputDir (str):
189
- The name of the subdirectory where cleaned files will be saved. This can start
190
- with the placeholder '{root}' which will be replaced with the root path of
191
- the BIDS dataset. Defaults to '{root}/derivatives/eegprep' if not specified.
192
-
193
- (overall run configuration)
194
- SkipIfPresent (bool):
195
- skip processing files that already have a cleaned version present.
196
- NumJobs (int, optional):
197
- The number of jobs to run in parallel. If set to -1, this will default to the
198
- number of logical cores on the system. If the ReservePerJob clause is also
199
- specified, this will be treated as a maximum, otherwise as the *total*. If neither
200
- of the two parameters is specified, a single job will run.
201
- Note: as usual when running multiple processes in Python, you need to use the
202
- if __name__ == "__main__": guard pattern in your main processing script.
203
- ReservePerJob (str):
204
- Optionally the resource amount and type to reserve per job, e.g. '4GB' or '2CPU';
205
- the run will then use as many jobs as fit within the system resources of the specified type.
206
- * You can also specify how much of a margin of the total system resources should
189
+ OutputDir : str
190
+ The name of the subdirectory where cleaned files will be saved. This can start
191
+ with the placeholder '{root}' which will be replaced with the root path of
192
+ the BIDS dataset. Defaults to '{root}/derivatives/eegprep' if not specified. (overall run configuration)
193
+
194
+ SkipIfPresent : bool
195
+ skip processing files that already have a cleaned version present.
196
+ NumJobs : int, optional
197
+ The number of jobs to run in parallel. If set to -1, this will default to the
198
+ number of logical cores on the system. If the ReservePerJob clause is also
199
+ specified, this will be treated as a maximum, otherwise as the *total*. If neither
200
+ of the two parameters is specified, a single job will run.
201
+ Note: as usual when running multiple processes in Python, you need to use the
202
+ if __name__ == "__main__": guard pattern in your main processing script.
203
+ ReservePerJob : str
204
+ Optionally the resource amount and type to reserve per job, e.g. '4GB' or '2CPU';
205
+ the run will then use as many jobs as fit within the system resources of the specified type.
206
+ * You can also specify how much of a margin of the total system resources should
207
207
  be *withheld* for use by other programs on the computer, by following the amount
208
208
  by a : and then the margin, as in '4GB:10GB' (always leave 10GB unused), '2CPU:10%'
209
209
  (always leave 10% of the total installed RAM unused). This also works with other metrics.
210
- * one may also specify a total or maximum number of jobs, as in '10total' or '10max'.
211
- * Multiple criteria can be spefied in a comma-separated list of reservations, e.g.
210
+ * one may also specify a total or maximum number of jobs, as in '10total' or '10max'.
211
+ * Multiple criteria can be spefied in a comma-separated list of reservations, e.g.
212
212
  '4GB:20%, 2CPU, 5max'.
213
- * If neither this nor NumJobs are specified, a single job will run. Note that the
213
+ * If neither this nor NumJobs are specified, a single job will run. Note that the
214
214
  system will also run in serial when in debug mode and when on a platform that does
215
215
  not cleanly support multiprocessing.
216
- Tip: a good way to size this is to perform a serial run and to monitor how much
216
+ Tip: a good way to size this is to perform a serial run and to monitor how much
217
217
  peak RAM a single job takes, and then setting this to <PeakUsage>GB:<YourMargin>GB
218
218
  where YourMargin is however much you want to leave to other programs, e.g., 5GB
219
219
  (this will depend on what else you expect to be running on the machine).
220
- UseHashes (bool): Whether to bake hashes into intermediate file names; if you experiment
221
- with alternative preprocessing settings, it is recommended to enable this or disable
222
- the SkipIfPresent option since otherwise the routine may pick up a stale result.
223
- ReturnData (bool):
224
- Whether to return the final EEG data objects as a list. Note that this can use
225
- quite a lot of memory for large studies and it may be better to iterate over
226
- the preprocessed files in downstream analyses.
220
+ UseHashes : bool
221
+ Whether to bake hashes into intermediate file names; if you experiment
222
+ with alternative preprocessing settings, it is recommended to enable this or disable
223
+ the SkipIfPresent option since otherwise the routine may pick up a stale result.
224
+ ReturnData : bool
225
+ Whether to return the final EEG data objects as a list. Note that this can use
226
+ quite a lot of memory for large studies and it may be better to iterate over
227
+ the preprocessed files in downstream analyses.
227
228
 
228
229
  (overall processing parameters)
229
- OnlyChannelsWithPosition (bool):
230
+ OnlyChannelsWithPosition : bool
230
231
  Whether to retain only channels for which positions were recorded or could be
231
232
  inferred. If this is not set, then OnlyModalities should be set so as to retain
232
233
  only modalities that should be preprocessed together.
233
- OnlyModalities (Sequence[str], optional):
234
+ OnlyModalities : Sequence[str], optional
234
235
  If set, retain only channels that have the associated modalities. If enabled, this
235
236
  is typically set to ['EEG'] but may also include other ExG modalities such as
236
237
  EOG or EMG that have the same unit and scale as EEG. If non-electrophysiological
237
238
  modalities are included, some artifact removal steps may not function correctly.
238
- SamplingRate (float):
239
+ SamplingRate : float
239
240
  Desired sampling rate for the preprocessed data. If not specified, will retain
240
241
  the original sampling rate.
241
- WithInterp (bool):
242
+ WithInterp : bool
242
243
  Whether to reinterpolate dropped channels, thus retaining the same channel
243
244
  count as the raw data.
244
- WithPicard (bool):
245
+ WithPicard : bool
245
246
  Whether to apply PICARD ICA decomposition after cleaning.
246
- WithICLabel (bool):
247
+ WithICLabel : bool
247
248
  Whether to apply ICLabel classification after ICA. Normally requires
248
249
  WithPicard=True.
249
- CommonAverageReference (bool):
250
+ CommonAverageReference : bool
250
251
  Whether to transform the EEG data to a common average referencing scheme;
251
252
  recommended for cross-study processing.
252
253
 
253
254
  (parameters for artifact removal - same as in clean_artifacts function)
254
- ChannelCriterion (float or 'off'):
255
+
256
+ ChannelCriterion : float or 'off'
255
257
  Minimum channel correlation threshold for channel cleaning; channels below
256
258
  this value are considered bad. Pass 'off' to skip channel criterion. Default 0.8.
257
- LineNoiseCriterion (float or 'off'):
259
+ LineNoiseCriterion : float or 'off'
258
260
  Z-score threshold for line-noise contamination; channels exceeding this are
259
261
  considered bad. 'off' disables line-noise check. Default 4.0.
260
- BurstCriterion (float or 'off'):
262
+ BurstCriterion : float or 'off'
261
263
  ASR standard-deviation cutoff for high-amplitude bursts; values above this
262
264
  relative to calibration data are repaired (or removed if BurstRejection='on').
263
265
  'off' skips ASR. Default 5.0.
264
- WindowCriterion (float or 'off'):
266
+ WindowCriterion : float or 'off'
265
267
  Fraction (0-1) or count of channels allowed to be bad per window; windows with
266
268
  more bad channels are removed. 'off' disables final window removal. Default 0.25.
267
- Highpass (tuple(float, float) or 'off'):
269
+ Highpass : tuple(float, float) or 'off'
268
270
  Transition band [low, high] in Hz for initial high-pass filtering. 'off' skips
269
271
  drift removal. Default (0.25, 0.75).
270
- ChannelCriterionMaxBadTime (float):
272
+ ChannelCriterionMaxBadTime : float
271
273
  Maximum tolerated time (seconds or fraction of recording) a channel may be flagged
272
274
  bad before being removed. Default 0.5.
273
- BurstCriterionRefMaxBadChns (float or 'off'):
275
+ BurstCriterionRefMaxBadChns : float or 'off'
274
276
  Maximum fraction of bad channels tolerated when selecting calibration data for ASR.
275
277
  'off' uses all data for calibration. Default 0.075.
276
- BurstCriterionRefTolerances (tuple(float, float) or 'off'):
278
+ BurstCriterionRefTolerances : tuple(float, float) or 'off'
277
279
  Power Z-score tolerances for selecting calibration windows in ASR. 'off' uses
278
280
  all data. Default (-inf, 5.5).
279
- BurstRejection (str):
281
+ BurstRejection : str
280
282
  'on' to reject (drop) burst segments instead of reconstructing with ASR,
281
283
  'off' to apply ASR repair. Default 'off'.
282
- WindowCriterionTolerances (tuple(float, float) or 'off'):
284
+ WindowCriterionTolerances : tuple(float, float) or 'off'
283
285
  Power Z-score bounds for final window removal. 'off' disables this stage.
284
286
  Default (-inf, 7).
285
- FlatlineCriterion (float or 'off'):
287
+ FlatlineCriterion : float or 'off'
286
288
  Maximum flatline duration in seconds; channels exceeding this are removed.
287
289
  'off' disables flatline removal. Default 5.0.
288
- NumSamples (int):
290
+ NumSamples : int
289
291
  Number of RANSAC samples for channel cleaning. Default 50.
290
- NoLocsChannelCriterion (float):
292
+ NoLocsChannelCriterion : float
291
293
  Correlation threshold for fallback channel cleaning when no channel locations.
292
294
  Default 0.45.
293
- NoLocsChannelCriterionExcluded (float):
295
+ NoLocsChannelCriterionExcluded : float
294
296
  Fraction of channels excluded when assessing correlation in nolocs cleaning.
295
297
  Default 0.1.
296
- MaxMem (int):
298
+ MaxMem : int
297
299
  Maximum memory in MB for ASR processing. Default 64.
298
- Distance (str):
300
+ Distance : str
299
301
  Distance metric for ASR processing ('euclidian'). Default 'euclidian'.
300
- Channels (Sequence[str] or None):
302
+ Channels : Sequence[str] or None
301
303
  List of channel labels to include before cleaning (pop_select). Default None.
302
- Channels_ignore (Sequence[str] or None):
304
+ Channels_ignore : Sequence[str] or None
303
305
  List of channel labels to exclude before cleaning. Default None.
304
- availableRAM_GB (float or None):
306
+ availableRAM_GB : float or None
305
307
  Available system RAM in GB to adjust MaxMem. Default None.
306
308
 
307
- (parameters for an optional epoching and baseline removal step)
308
- EpochEvents (str or Sequence[str] or None):
309
+ (parameters for an optional epoching and baseline removal step)
310
+ EpochEvents : str or Sequence[str] or None
309
311
  Optionally a list of event types or regular expression matching event types
310
312
  at which to time-lock epochs. If None (default), no epoching is done. If [],
311
313
  will time-lock to every event in the data (warning, this can amplify the data
312
314
  if epochs overlap!)
313
- EpochLimits (Sequence[float]):
315
+ EpochLimits : Sequence[float]
314
316
  The time limits in seconds relative to the event markers for epoching. Default (-1, 2).
315
- EpochBaseline (Sequence[float] or None):
317
+ EpochBaseline : Sequence[float] or None
316
318
  Optionally a time range in seconds relative to the event markers for baseline
317
319
  correction. If None (default), no baseline correction is applied. The special
318
320
  value None can be used to refer to the respective end of the epoch limits,
319
321
  as in (None, 0).
320
322
 
321
323
  (misc parameters)
322
- StageNames Sequence[str]:
324
+
325
+ StageNames : Sequence[str]
323
326
  list of file name parts for the preprocessing stages, in the order of cleaning,ica,iclabel;
324
327
  these can be adjusted when working with different preprocessed versions (e.g., using
325
328
  different parameters for cleaning). It is recommended that these start with 'desc-'.
326
- MinimizeDiskUsage (bool):
329
+ MinimizeDiskUsage : bool
327
330
  whether to minimize disk usage by not saving some intermediate files (specifically
328
331
  the PICARD output if WithICLabel=False). Default True.
329
332
 
330
333
  (parameters retained for backwards compatibility with EEGLAB's pop_importbids call signature)
331
- bidsmetadata (bool): alias for ApplyMetadata
332
- bidsevent (bool): alias for ApplyEvents
333
- bidschanloc (bool): alias for ApplyChanlocs
334
- eventtype (str): alias for EventColumn
335
- subjects (Sequence[str | int], optional): alias for Subjects
336
- sessions (Sequence[str | int], optional): alias for Sessions
337
- runs (Sequence[str | int], optional): alias for RUns
338
- tasks (Sequence[str] | str, optional): alias for Tasks
339
- outputdir (str): alias for OutputDir
340
-
341
- Returns:
342
- --------
334
+
335
+ bidsmetadata : bool
336
+ alias for ApplyMetadata
337
+ bidsevent : bool
338
+ alias for ApplyEvents
339
+ bidschanloc : bool
340
+ alias for ApplyChanlocs
341
+ eventtype : str
342
+ alias for EventColumn
343
+ subjects : Sequence[str | int], optional
344
+ alias for Subjects
345
+ sessions : Sequence[str | int], optional
346
+ alias for Sessions
347
+ runs : Sequence[str | int], optional
348
+ alias for RUns
349
+ tasks : Sequence[str] | str, optional
350
+ alias for Tasks
351
+ outputdir : str
352
+ alias for OutputDir
353
+
354
+ Returns
355
+ -------
356
+ result : Dict[str,Any] | List[Dict[str, Any]] | None
343
357
  Depending on ReturnData, either a list of EEG objects (if BIDS root folder was
344
358
  specified) or a single EEG object (if a single file was specified), otherwise None.
345
359
  """
@@ -353,8 +367,10 @@ def bids_preproc(
353
367
  from .utils.bids import gen_derived_fpath
354
368
 
355
369
  def hash_suffix(ignore: Optional[set] = None, *, prefix='#') -> str:
356
- """Get a hash for all options that affect results minus the ones listed in ignore,
357
- unless UseHashes is False (in which case an empty string is returned)."""
370
+ """Get a hash for all options that affect results minus the ones listed in ignore.
371
+
372
+ Unless UseHashes is False (in which case an empty string is returned).
373
+ """
358
374
  if not UseHashes:
359
375
  return ''
360
376
  # set of options in kwargs that do NOT influence the processing result; all others