Python Noise-Tagging Brain-Computer Interface (PyntBCI)
Project description
PyntBCI
The Python Noise-Tagging Brain-Computer Interfacing (PyntBCI) library is a specialized Python toolbox developed for the noise-tagging brain-computer interfacing (BCI) project at the Donders Institute for Brain, Cognition, and Behaviour at Radboud University in Nijmegen, the Netherlands. PyntBCI offers a suite of signal processing tools and machine learning algorithms tailored for BCIs using evoked responses, such as those recorded by electroencephalography (EEG). It is particularly focused on supporting code-modulated responses like the code-modulated visual evoked potential (c-VEP).
For detailed documentation as wel as tutorials and examples, see:
For a constructive review of the c-VEP BCI field, see:
- Martínez-Cagigal, V., Thielen, J., Santamaría-Vázquez, E., Pérez-Velasco, S., Desain, P., & Hornero, R. (2021). Brain–computer interfaces based on code-modulated visual evoked potentials (c-VEP): a literature review. Journal of Neural Engineering. DOI: 10.1088/1741-2552/ac38cf
For an extensive literature overview, also see:
For an example of an online BCI with PyntBCI, see our Dareplane implementation:
- https://github.com/thijor/dp-cvep
- https://github.com/thijor/dp-cvep-speller
- https://github.com/thijor/dp-cvep-decoder
Installation
To install PyntBCI, use:
pip install pyntbci
Getting started
Various tutorials and example analysis pipelines are provided in the tutorials/
and examples/
folder, which operate on limited preprocessed data as provided with PyntBCI. Furthermore, please find various pipelines for several open-access datasets below in the pipelines/
folder.
Referencing
When using PyntBCI, please reference at least one of the following:
- Thielen, J., van den Broek, P., Farquhar, J., & Desain, P. (2015). Broad-Band visually evoked potentials: re(con)volution in brain-computer interfacing. PLOS ONE, 10(7), e0133797. DOI: 10.1371/journal.pone.0133797
- Thielen, J., Marsman, P., Farquhar, J., & Desain, P. (2021). From full calibration to zero training for a code-modulated visual evoked potentials for brain–computer interface. Journal of Neural Engineering, 18(5), 056007. DOI: 10.1088/1741-2552/abecef
Contact
- Jordy Thielen (jordy.thielen@donders.ru.nl)
Licensing
PyntBCI is licensed by the BSD 3-Clause License:
Copyright (c) 2021, Jordy Thielen All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Changelog
Version 1.8.0 (08-11-2024)
Added
- Added
min_time
to stopping methods instopping
- Added
max_time
toCriterionStopping
instopping
Changed
Fixed
- Fixed fit exception in
DistributionStopping
instopping
Version 1.7.0 (22-10-2024)
Added
- Added
tmin
toencoding_matrix
inutilities
- Added
tmin
torCCA
inclassifiers
Changed
Fixed
Version 1.6.1 (10-10-2024)
Added
- Added
find_neighbours
andfind_worst_neighbour
toutilities
- Added
optimize_subset_clustering
tostimulus
- Added
optimize_layout_incremental
tostimulus
- Added
stimplot
toplotting
Changed
- Changed order of tutorials and examples
Fixed
- Fixed
max_time
in allstopping
classes to deal with "partial" segments
Version 1.5.0 (30-09-2024)
Added
- Added
ValueStopping
tostopping
- Added parameter
distribution
toDistributionStopping
instopping
Changed
- Changed
envelope_rms
torms
inenvelope
- Changed
envelope_gammatone
togammatone
inenvelope
- Changed
BetaStopping
instopping
toDistributionStopping
Fixed
- Fixed default
CCA
intransformers
toinv
, notpinv
- Fixed
seed
formake_m_sequence
andmake_gold_codes
instimulus
to not be full zeros
Version 1.4.1 (19-07-2024)
Added
Changed
Fixed
- Fixed default
CCA
intransformers
toinv
, notpinv
Version 1.4.0 (15-07-2024)
Added
- Added
pinv
toutilities
- Added
alpha_x
toCCA
intranformers
- Added
alpha_y
toCCA
intranformers
- Added
alpha_x
toeCCA
inclassifiers
- Added
alpha_t
toeCCA
inclassifiers
- Added
alpha_x
torCCA
inclassifiers
- Added
alpha_m
torCCA
inclassifiers
- Added
squeeze_components
torCCA
,eCCA
,eTRCA
in `classifiers'
Changed
- Changed
numpy
typing ofnp.ndarray
toNDArray
- Changed
cca_
andtrca_
attributes to belist
always ineCCA
,rCCA
andeTRCA
- Changed
scipy.linalg.inv
topyntbci.utilities.pinv
inCCA
oftransformers
- Changed
decision_function
andpredict
ofclassifiers
to return without additional dimension for components ifn_components=1
andsqueeze_components=True
, both of which are defaults
Fixed
Version 1.3.3 (01-07-2024)
Added
Changed
Fixed
- Fixed components bug in
decision_function
ofeCCA
inclassifiers
Version 1.3.2 (23-06-2024)
Added
- Added
cov_estimator_t
toeCCA
inclassifiers
Changed
- Changed separate covariance estimators for data and templates in
eCCA
ofclassifiers
Fixed
Version 1.3.1 (23-06-2024)
Added
Changed
Fixed
- Fixed zero division
eventplot
inplotting
- Fixed event order duration event
event_matrix
inutilities
Version 1.3.0 (18-06-2024)
Added
- Removed
gating
ofrCCA
inclassifiers
- Removed
_score
methods inclassifiers
- Added
n_components
ineCCA
inclassifiers
- Added
n_components
ineTRCA
inclassifiers
Changed
- Changed "bes" to "bds" in
BayesStopping
instopping
in line with publication - Changed
lx
andly
togamma_x
andgamma_y
iofeCCA
inclassifiers
- Changed
gating
togates
- Changed
TRCA
intransformers
to deal with one-class data only - Changed
_get_T
toget_T
in allclassifiers
Fixed
Version 1.2.0 (18-04-2024)
Added
Changed
- Changed
lx
ofrCCA
inclassifiers
togamma_x
, which ranges between 0-1, such that the parameter represents shrinkage regularization - Changed
ly
ofrCCA
inclassifiers
togamma_m
, which ranges between 0-1, such that the parameter represents shrinkage regularization - Changed
lx
ofCCA
intransformers
togamma_x
, which ranges between 0-1, such that the parameter represents shrinkage regularization - Changed
ly
ofCCA
intransformers
togamma_y
, which ranges between 0-1, such that the parameter represents shrinkage regularization
Fixed
Version 1.1.0 (17-04-2024)
Added
- Added
envelope
module containingenvelope_gammatone
andenvelope_rms
functions - Added
CriterionStopping
tostopping
for some static stopping methods
Changed
- Changed default value of
encoding_length
inrCCA
ofclassifiers
of 0.3 to None, which is equivalent to 1 / fs
Fixed
- Fixed variable
fs
of type np.ndarray instead of int in examples, tutorials, and pipelines - Fixed double call to
decoding_matrix
infit
ofrCCA
inclassifiers
Version 1.0.1 (26-03-2024)
Added
- Added
set_stimulus_amplitudes
forrCCA
inclassifiers
Changed
Fixed
- Fixed dependency between
stimulus
andamplitudes
inrCCA
ofclassifiers
Version 1.0.0 (22-03-2024)
Added
- Added variable
decoding_length
ofrCCA
inclassifier
controlling the length of a learned spectral filter - Added variable
decoding_stride
ofrCCA
inclassifier
controlling the stride of a learned spectral filter - Added function
decoding_matrix
inutilities
to phase-shit the EEG data maintaining channel-prime ordering - Added variable
encoding_stride
ofrCCA
inclassifier
controlling the stride of a learned temporal response - Added module
gating
with gating functions, for instance for multi-component or filterbank analysis - Added variable
gating
ofrCCA
inclassifier
to deal with multiple CCA components - Added variable
gating
ofEnsemble
inclassifier
, for example to deal with a filterbank
Changed
- Changed variable
codes
ofrCCA
inclassifiers
tostimulus
- Changed variable
transient_size
ofrCCA
inclassifiers
toencoding_length
- Changed class
FilterBank
inclassifiers
toEnsemble
- Changed function
structure_matrix
inutilities
toencoding_matrix
Fixed
- Fixed several documentation issues
Version 0.2.5 (29-02-2024)
Added
- Added function
eventplot
inplotting
to visualize an event matrix - Added variable
running
ofcovariance
inutilities
to do incremental running covariance updates - Added variable
running
ofCCA
intransformers
to use a running covariance for CCA - Added variable
cov_estimator_x
andcov_estimator_m
ofrCCA
inclassifiers
to change the covariance estimator - Added event definitions "on", "off" and "onoff" for
event_matrix
inutilities
Changed
- Changed the CCA optimization to contain separate computations for Cxx, Cyy and Cxy
- Changed the CCA to allow separate BaseEstimators for Cxx and Cyy
Fixed
- Fixed zero-division in
itr
inutilities
Version 0.2.4
Added
- Added CCA cumulative/incremental average and covariance
- Added
amplitudes
(e.g. envelopes) instructure_matrix
ofutilities
- Added
max_time
to classes instopping
to allow a maximum stopping time for stopping methods - Added brainamp64.loc to capfiles
- Added plt.show() in all examples
Changed
Fixed
Version 0.2.3
Added
Changed
- Changed example pipelines to include more examples and explanation
- Changed tutorial pipelines to include more examples and explanation
Fixed
- Fixed several documentation issues
Version 0.2.2
Added
- Added class
TRCA
totransformers
- Added class
eTRCA
toclassifiers
- Added parameter
ensemble
to classes inclassifiers
to allow a separate spatial filter per class
Changed
- Changed package name from PyNT to PyntBCI to avoid clash with existing pynt library
- Changed filter order in
filterbank
ofutilities
to be optimized given input parameters
Fixed
- Fixed issue in
rCCA
ofclassifiers
causing novel events in structure matrix when "cutting cycles" - Fixed
correlation
to not contain mutable input variables
Version 0.2.1
Added
- Added
tests
- Added tutorials
Changed
- Changed
rCCA
to work with non-binary events instead of binary only
Fixed
Version 0.2.0
Added
- Added dynamic stopping: classes
MarginStopping
,BetaStopping
, andBayesStopping
in modulestopping
- Added value inner for variable
score_metric
in 'classifiers'
Changed
- Changed all data shapes from (channels, samples, trials) to (trials, channels, samples)
- Changed all codes shapes from (samples, classes) to (classes, samples)
- Changed all decision functions to similarity, not distance (e.g., Euclidean), to always maximize
Fixed
- Fixed zero-mean templates in
eCCA
andrCCA
ofclassifiers
Version 0.1.0
Added
- Added
Filterbank
toclassifiers
Changed
- Changed classifiers all have
predict
anddecision_function
methods inclassifiers
Fixed
Version 0.0.2
Added
Changed
- Changed CCA method from sklearn to custom covariance method
Fixed
Version 0.0.1
Added
- Added
eCCA
template metrics: average, median, OCSVM - Added
eCCA
spatial filter options: all channels or subset
Changed
Fixed
Version 0.0.0
Added
- Added
CCA
intransformers
- Added
rCCA
inclassifiers
- Added
eCCA
inclassifier
Changed
Fixed
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyntbci-1.8.0.tar.gz
.
File metadata
- Download URL: pyntbci-1.8.0.tar.gz
- Upload date:
- Size: 45.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 991ecbef8a23f7f1c02e7d58210b12bc3780e5bd8283feaa2871980ff120a2c1 |
|
MD5 | be9bb98f625ddc7d4d71eed11186a5c5 |
|
BLAKE2b-256 | fcec0943f5765d165363ccd5ab41effaba0f0f85d1cbca23120e1d7cebe018f4 |
File details
Details for the file pyntbci-1.8.0-py3-none-any.whl
.
File metadata
- Download URL: pyntbci-1.8.0-py3-none-any.whl
- Upload date:
- Size: 45.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aad4089901160dd6a46dfae12ece55f029e675b308fc591f80da32357f107e78 |
|
MD5 | 3f04f2ba25983437f4f9f626944f3b7e |
|
BLAKE2b-256 | 8336f48043ec080434c843c74fdb39436801d3b68f266f5ff5937b84fcfdfc01 |