pyntbci.stimulus.is_gold_code

pyntbci.stimulus.is_gold_code(stimulus: ndarray[Any, dtype[_ScalarType_co]]) bool[source]

Check whether a stimulus is a Gold code. Gold codes [3] have a 3-valued auto- and cross-correlation function [4]. If the length of the linear feedback shift register m is even: * 1/(2^n−1) * −(2^{(n+2)/2}+1)/(2^n−1) * (2^{(n+2)/2}−1)/(2^n−1) in ratio ~3/4, ~1/8, ~1/8. If the length of the linear feedback shift register n is odd: * 1/(2^n−1) * −(2^{(n+1)/2}+1)/(2^n−1) * (2^{(n+1)/2}−1)/(2^n−1) in ratio ~1/2, ~1/4, ~1/4

Parameters:

stimulus (NDArray) – A vector with the Gold code of shape (n_classes, n_bits).

Returns:

out – True if the stimulus is a Gold code, otherwise False.

Return type:

bool

References