API Reference¶
Core¶
Base pydantic model with extra=forbid and nicer print |
|
Base class for composable pipeline nodes. |
|
A sequence of processing steps executed in order. |
|
Sampling rate in Hz, with helpers for second/sample conversion. |
|
Numpy array annotated with time metadata. |
Studies¶
Interface to an external dataset: loads events from raw recordings. |
|
Loader for special methods that need to be serialized and called later. |
|
Records expected dataset characteristics for testing and validation. |
Events¶
Event indicating the participant performed (or imagined) an action. |
|
Artifact or noise event in neural recordings. |
|
Audio event corresponding to a WAV file. |
|
'Background' activity, i.e. no specific epilepsy or arousal event happening during this time. |
|
Base class for events whose data needs to be read from a file. |
|
Base class for dynamic events (audio and video) which can be read in parts. |
|
Base class for text-based events. |
|
Base class for categorical events. |
|
Electroencephalography (EEG) recording event. |
|
Electromyography (EMG) recording event. |
|
Base class for all event types. |
|
Eye state event indicating whether eyes are open or closed. |
|
Functional MRI (fMRI) recording event. |
|
Functional Near-Infrared Spectroscopy (fNIRS) recording event. |
|
Intracranial EEG (iEEG) event. |
|
Image event with optional caption. |
|
Keystroke event with associated text. |
|
Magnetoencephalography (MEG) recording event. |
|
Brain recording saved as MNE Raw object. |
|
Single phoneme event. |
|
Seizure event with specific seizure type classification. |
|
Single sentence text event with optional context information. |
|
Sleep stage event following AASM manual classification [sleep1]. |
|
Spikes recording event saved as HDF5 object. |
|
General stimulus presentation event identified by a code. |
|
General text event, possibly containing multiple sentences. |
|
Video event with support for partial loading. |
|
Single word event with optional sentence information. |
Transforms¶
Creates timelines where events (eg: Meg, FMRI) are aligned to a trigger (eg: Image / Word) |
|
Modifies loading parameters for events with dynamic filepaths, i.e., URIs and JSON SpecialLoader jsons. |
|
Create a new column with a default value, and optionally update selected rows via a query. |
|
Filter events based on a pandas query, with auto-generated index columns. |
|
Remove events of specified type(s) that have missing or empty values in a given field. |
|
Select a subset of events based on unique values in a column. |
Create Text events from Words if not already present. |
|
Adds contextual information to events by concatenating previous events of the same type. |
|
Add a context field to the events dataframe, for each word event, by concatenating the sentence fields. |
|
Add Part-Of-Speech (POS) tags to events. |
|
Add phoneme information to events. |
|
Adds sentence-level information to word events based on Text rows. |
|
Generate concise summaries for Text events using a pretrained language model. |
Assign k splits to events. |
|
Assign a train/val/test split to each sentence in a deterministic fashion. |
|
Sequence of 3 standard operations: add sentences, assign split, add context. |
|
Perform train/val/test split using sklearn's |
Extract audio tracks from Video events and add them as separate Audio events. |
This functions chunks long events (audio or video) into shorter events. |
Extractors — Base¶
Extractors — General¶
Extracts time-aligned extractors from event annotations. |
|
Extractor which extracts an int or float attribute from an event. |
|
Encode a given field from an event, e.g. to be used as a label. |
|
Constant-one extractor — returns a single 1.0 scalar for every event. |
Extractors — Neuro¶
Channel positions in 2D or 3D, extracted from a Raw object's mne.Info. |
|
EEG feature extractor. |
|
EMG feature extractor. |
|
fMRI feature extraction with optional projection, signal cleaning, and caching to a NumPy memmap. |
|
Functional Near-Infrared Spectroscopy (fNIRS) feature extractor. |
|
Convolve the output of an extractor by the Hemodynamic Response Function. |
|
Intracranial EEG feature extractor. |
|
MEG feature extractor. |
|
Feature extractor for raw MNE data files. |
|
Feature extractor for spike data stored in HDF5/NWB files. |
Extractors — Audio¶
Base class for extracting audio features from Hugging Face models. |
|
Compute the Mel spectrogram representation of an audio waveform. |
|
Extract speech embeddings using the pretrained Seamless M4T model from Hugging Face. |
|
Extract deep audio embeddings from waveforms using the Sonar speech encoder. |
|
Extract the acoustic amplitude envelope from audio waveforms. |
|
Extract speech embeddings using a pretrained Wav2Vec 2.0 model from Hugging Face. |
|
Extract speech embeddings using the pretrained Wav2Vec2-BERT model from Hugging Face. |
|
Extract speech embeddings using the pretrained Whisper model from Hugging Face. |
Extractors — Text¶
Get embeddings from HuggingFace language models. |
|
Get embeddings from SentenceTransformers: https://huggingface.co/sentence-transformers. |
|
Get embeddings from sonar: https://arxiv.org/abs/2308.11466 |
|
Get word embedding from spacy. |
|
Get TF-IDF embeddings for Sentence events. |
|
Get word frequency from wordfreq package. |
|
Get word length. |
Extractors — Image¶
Color histogram. |
|
Histogram of oriented gradients (Dalal & Triggs, 2005). |
|
Compute image embeddings using transformer-based models obtained through HuggingFace API. |
|
Local Binary Pattern (LBP). |
|
(Cropped) 2D Fourier spectrum of an image of real values. |
Extractors — Video¶
Extract video features using a HuggingFace transformer model. |
Extractors — Meta¶
Aggregate multiple extractors along the specified dimension. |
|
Crop a extractor to a given offset and duration. |
|
Applies a PCA to another extractor's data The underlying extractor is first computed through the prepare method, and then the current extractor applies the PCA on it. |
|
Applies a PCA to the underlying HuggingFace extractor. |
|
Remove the time dimension of a dynamic extractor, either by summing/averaging or by selecting the first, middle or last time point. |
|
Crop a extractor by a given offset and duration. |
DataLoader¶
Build a |
|
Dataset defined through |
|
A collection of extracted features for a list of segments. |
Splitting¶
Hash-based splitter that assigns a deterministic train/val/test split. |
|
Split events into smaller chunks. |
A class used to split events based on similarity clustering of static extractors. |