pycrostates.preprocessing.resample#
- pycrostates.preprocessing.resample(inst, picks=None, tmin=None, tmax=None, reject_by_annotation=True, n_resamples=None, n_samples=None, coverage=None, replace=True, random_state=None, verbose=None)[source]#
Resample a recording into epochs of random samples.
Resample
Raw.EpochsorChDatainton_resampleseach containingn_samplesrandom samples of the original recording.- Parameters:
- inst
Raw|Epochs|ChData Instance to resample.
- picks
str| array_like |slice|None Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g.,
['meg', 'eeg']) will pick channels of those types, channel name strings (e.g.,['MEG0111', 'MEG2623']will pick the given channels. Can also be the string values'all'to pick all channels, or'data'to pick data channels. None (default) will pick all channels. Note that channels ininfo['bads']will be included if their names or indices are explicitly provided.- tmin
float Start time of the raw data to use in seconds (must be >= 0).
- tmax
float|None End time of the raw data to use in seconds (cannot exceed data duration). If
None(default), the current end of the data is used.- reject_by_annotation
bool Whether to omit bad segments from the data before fitting. If
True(default), annotated segments whose description begins with'bad'are omitted. IfFalse, no rejection based on annotations is performed.Has no effect if
instis not amne.io.Rawobject.- n_resamples
int Number of resamples to draw. Each epoch can be used to fit a separate clustering solution. See notes for additional information.
- n_samples
int Length of each epoch (in samples). See notes for additional information.
- coverage
float Strictly positive ratio between resampling data size and size of the original recording. See notes for additional information.
- replace
bool Whether or not to allow resampling with replacement.
- random_state
None|int| instance ofRandomState A seed for the NumPy random number generator (RNG). If
None(default), the seed will be obtained from the operating system (seeRandomStatefor details), meaning it will most likely produce different output every time this function or method is run. To achieve reproducible results, pass a value here to explicitly initialize the RNG with a defined state.- verbose
int|str|bool|None Sets the verbosity level. The verbosity increases gradually between
"CRITICAL","ERROR","WARNING","INFO"and"DEBUG". If None is provided, the verbosity is set to"WARNING". If a bool is provided, the verbosity is set to"WARNING"for False and to"INFO"for True.
- inst
- Returns:
Notes
Only two of
n_resamples,n_samplesandcoverageparameters must be defined, the non-defined one will be determine at runtime by the 2 other parameters.