goofi-pipe
Generative Organic Oscillation Feedback Isomorphism Pipeline
Installation
If you only want to run goofi-pipe and not edit any of the code, make sure you activated the desired Python environment with Python>=3.9 and run the following commands in your terminal:
pip install goofi
goofi-pipe
[!NOTE]
On some platforms (specifically Linux and Mac) it might be necessary to install the liblsl
package for some of goofi-pipe's features (everything related to LSL streams).
Follow the instructions provided here, or simply install it via
conda install -c conda-forge liblsl
Development
Follow these steps if you want to adapt the code of existing nodes, or create custom new nodes. In your terminal, make sure you activated the desired Python environment with Python>=3.9, and that you are in the directory where you want to install goofi-pipe. Then, run the following commands:
git clone git@github.com:PhilippThoelke/goofi-pipe.git
cd goofi-pipe
pip install -e .
goofi-pipe
Basic Usage
To access the node menu, simply double-click anywhere within the application window or press the 'Tab' key. The node menu allows you to add various functionalities to your pipeline. Nodes are categorized for easy access, but if you're looking for something specific, the search bar at the top is a handy tool.
Common Parameters and Metadata
Common Parameters: All nodes within goofi have a set of common parameters. These settings consistently dictate how the node operates within the pipeline.
-
AutoTrigger: This option, when enabled, allows the node to be triggered automatically. When disabled,
the node is triggered when it receives input.
-
Max_Frequency: This denotes the maximum rate at which computations are set for the node.
Metadata: This section conveys essential information passed between nodes. Each output node will be accompanied by its metadata, providing clarity and consistency throughout the workflow.
Here are some conventional components present in the metadata
-
Channel Dictionary: A conventional representation of EEG channels names.
-
Sampling Frequency: The rate at which data samples are measured. It's crucial for maintaining consistent data input and output across various nodes.
-
Shape of the Output: Details the format and structure of the node's output.
Playing with Pre-recorded EEG Signal using LslStream
This image showcases the process of utilizing a pre-recorded EEG signal through the LslStream
node. It's crucial to ensure that the Stream Name
in the LslStream
node matches the stream name in the node receiving the data. This ensures data integrity and accurate signal processing in real-time.
Patch examples
Basic Signal Processing Patch
This patch provides a demonstration of basic EEG signal processing using goofi-pipe.
-
EegRecording: This is the starting point where the EEG data originates.
-
LslClient: The LslClient
node retrieves the EEG data from EegRecording
. Here, the visual representation of the EEG data being streamed in real-time is depicted. By default, the multiple lines in the plot correspond to the different EEG channels.
-
Buffer: This node holds the buffered EEG data.
-
Psd: Power Spectral Density (PSD) is a technique to measure a signal's power content versus frequency. In this node, the raw EEG data is transformed to exhibit its power distribution across distinct frequency bands.
-
Math: This node is employed to execute mathematical operations on the data. In this context, it's rescaling the values to ensure a harmonious dynamic range between 0 and 1, which is ideal for image representation. The resultant data is then visualized as an image.
One of the user-friendly features of goofi-pipe is the capability to toggle between different visualizations. By 'Ctrl+clicking' on any plot within a node, you can effortlessly switch between a line plot and an image representation, offering flexibility in data analysis.
Sending Power Bands via Open Sound Control (OSC)
Expanding on the basic patch, the advanced additions include:
- Select: Chooses specific EEG channels.
- PowerBandEEG: Computes EEG signal power across various frequency bands.
- ExtendedTable: Prepares data for transmission in a structured format.
- OscOut: Sends data using the Open-Sound-Control (OSC) protocol.
These nodes elevate data processing and communication capabilities.
Real-Time Connectivity and Spectrogram
This patch highlights:
-
Connectivity: Analyzes relationships between EEG channels, offering selectable methods like wPLI
, coherence
, PLI
, and more.
-
Spectrogram: Created using the PSD
node followed by a Buffer
, it provides a time-resolved view of the EEG signal's frequency content.
Principal Component Analysis (PCA)
Using PCA (Principal Component Analysis) allows us to reduce the dimensionality of raw EEG data, while retaining most of the variance. We use the first three components and visualize their trajectory, allowing us to identify patterns in the data over time. The topographical maps show the contrbution of each channel to the first four principal components (PCs).
Realtime Classification
leverage the multimodal framework of goofi, state-of-the-art machine learning classifiers can be built on-the-fly to predict behavior from an array of different sources. Here's a brief walkthrough of three distinct examples:
1. EEG Signal Classification
This patch captures raw EEG signals using the EEGrecording
and LslStream
module. The classifier module allows
to capture data from different states indicated by the user from n features, which in the present case are the 64 EEG channels. Some classifiers allow for visualization of feature importance. Here we show a topomap of the distribution of features importances on the scalp. The classifier outputs probability of being in each of the states in the training data. This prediction is smoothed using a buffer for less jiterry results.
2. Audio Input Classification
The audio input stream captures real-time sound data, which can also be passed through a classifier. Different sonic states can be predicted in realtime.
3. Video Input Classification
In this example, video frames are extracted using the VideoStream
module. Similarly, prediction of labelled visual states can be achieved in realtime.
The images show how two states (being on the left or the right side of the image) can be detected using classification
These patches demonstrate the versatility of our framework in handling various types of real-time data streams for classification tasks.
Musical Features using Biotuner
This patch presents a pipeline for processing EEG data to extract musical features:
-
Data flows from the EEG recording through several preprocessing nodes and culminates in the Biotuner node, which specializes in deriving musical attributes from the EEG.
-
Biotuner Node: With its sophisticated algorithms, Biotuner pinpoints harmonic relationships, tension, peaks, and more, essential for music theory analysis.
Delving into the parameters of the Biotuner node:
N Peaks
: The number of spectral peaks to consider.F Min
& F Max
: Defines the frequency range for analysis.Precision
: Sets the precision in Hz for peak extraction.Peaks Function
: Method to compute the peaks, like EMD, fixed band, or harmonic recurrence.N Harm Subharm
& N Harm Extended
: Configures number of harmonics used in different computations.Delta Lim
: Defines the maximal distance between two subharmonics to include in subharmonic tension computation.
For a deeper understanding and advanced configurations, consult the Biotuner repository.
Data Types
To simplify understanding, we've associated specific shapes with data types at the inputs and outputs of nodes:
- Circles: Represent arrays.
- Triangles: Represent strings.
- Squares: Represent tables.
Node Categories
Analysis
Nodes that perform analysis on the data.
View Nodes
AudioTagging
- Inputs:
- Outputs:
- tags: STRING
- probabilities: ARRAY
- embedding: ARRAY
Avalanches
- Inputs:
- Outputs:
- size: ARRAY
- duration: ARRAY
Binarize
Bioelements
Bioplanets
- Inputs:
- Outputs:
- planets: TABLE
- top_planets: STRING
Biorhythms
- Inputs:
- Outputs:
- pulses: ARRAY
- steps: ARRAY
- offsets: ARRAY
Biotuner
- Inputs:
- Outputs:
- harmsim: ARRAY
- tenney: ARRAY
- subharm_tension: ARRAY
- cons: ARRAY
- peaks_ratios_tuning: ARRAY
- harm_tuning: ARRAY
- peaks: ARRAY
- amps: ARRAY
- extended_peaks: ARRAY
- extended_amps: ARRAY
CardiacRespiration
CardioRespiratoryVariability
- Inputs:
- Outputs:
- MeanNN: ARRAY
- SDNN: ARRAY
- SDSD: ARRAY
- RMSSD: ARRAY
- pNN50: ARRAY
- LF: ARRAY
- HF: ARRAY
- LF/HF: ARRAY
- LZC: ARRAY
Classifier
- Inputs:
- Outputs:
- probs: ARRAY
- feature_importances: ARRAY
Clustering
- Inputs:
- Outputs:
- cluster_labels: ARRAY
- cluster_centers: ARRAY
Compass
- Inputs:
- north: ARRAY
- south: ARRAY
- east: ARRAY
- west: ARRAY
- Outputs:
Connectivity
Coord2loc
- Inputs:
- latitude: ARRAY
- longitude: ARRAY
- Outputs:
Correlation
DissonanceCurve
- Inputs:
- Outputs:
- dissonance_curve: ARRAY
- tuning: ARRAY
- avg_dissonance: ARRAY
EigenDecomposition
- Inputs:
- Outputs:
- eigenvalues: ARRAY
- eigenvectors: ARRAY
ERP
- Inputs:
- signal: ARRAY
- trigger: ARRAY
- Outputs:
FacialExpression
- Inputs:
- Outputs:
- emotion_probabilities: ARRAY
- action_units: ARRAY
- main_emotion: STRING
Fractality
GraphMetrics
- Inputs:
- Outputs:
- clustering_coefficient: ARRAY
- characteristic_path_length: ARRAY
- betweenness_centrality: ARRAY
- degree_centrality: ARRAY
- assortativity: ARRAY
- transitivity: ARRAY
HarmonicSpectrum
- Inputs:
- Outputs:
- harmonic_spectrum: ARRAY
- max_harmonicity: ARRAY
- avg_harmonicity: ARRAY
Img2Txt
LempelZiv
PCA
- Inputs:
- Outputs:
- principal_components: ARRAY
PoseEstimation
PowerBand
PowerBandEEG
- Inputs:
- Outputs:
- delta: ARRAY
- theta: ARRAY
- alpha: ARRAY
- lowbeta: ARRAY
- highbeta: ARRAY
- gamma: ARRAY
ProbabilityMatrix
SpectroMorphology
SpeechSynthesis
- Inputs:
- Outputs:
- speech: ARRAY
- transcript: STRING
TransitionalHarmony
- Inputs:
- Outputs:
- trans_harm: ARRAY
- melody: ARRAY
TuningColors
- Inputs:
- Outputs:
- hue: ARRAY
- saturation: ARRAY
- value: ARRAY
- color_names: STRING
TuningMatrix
- Inputs:
- Outputs:
- matrix: ARRAY
- metric_per_step: ARRAY
- metric: ARRAY
TuningReduction
VAMP
VocalExpression
- Inputs:
- Outputs:
- prosody_label: STRING
- burst_label: STRING
- prosody_score: ARRAY
- burst_score: ARRAY
Array
Nodes implementing array operations.
View Nodes
Clip
Join
Math
Operation
Reduce
Reshape
Select
Transpose
Inputs
Nodes that provide data to the pipeline.
View Nodes
Audiocraft
AudioStream
ConstantArray
ConstantString
EEGRecording
ExtendedTable
- Inputs:
- base: TABLE
- array_input1: ARRAY
- array_input2: ARRAY
- array_input3: ARRAY
- array_input4: ARRAY
- array_input5: ARRAY
- string_input1: STRING
- string_input2: STRING
- string_input3: STRING
- string_input4: STRING
- string_input5: STRING
- Outputs:
FractalImage
ImageGeneration
- Inputs:
- prompt: STRING
- negative_prompt: STRING
- base_image: ARRAY
- Outputs:
Kuramoto
- Inputs:
- Outputs:
- phases: ARRAY
- coupling: ARRAY
- order_parameter: ARRAY
- waveforms: ARRAY
LoadFile
LSLClient
MeteoMedia
- Inputs:
- latitude: ARRAY
- longitude: ARRAY
- location_name: STRING
- Outputs:
- weather_data_table: TABLE
OSCIn
PromptBook
Reservoir
SerialStream
Sine
Table
- Inputs:
- base: TABLE
- new_entry: ARRAY
- Outputs:
TextGeneration
VideoStream
ZeroMQIn
Misc
Miscellaneous nodes that do not fit into other categories.
View Nodes
AppendTables
- Inputs:
- table1: TABLE
- table2: TABLE
- Outputs:
ColorEnhancer
EdgeDetector
FormatString
- Inputs:
- input_string_1: STRING
- input_string_2: STRING
- input_string_3: STRING
- input_string_4: STRING
- input_string_5: STRING
- input_string_6: STRING
- input_string_7: STRING
- input_string_8: STRING
- input_string_9: STRING
- input_string_10: STRING
- Outputs:
HSVtoRGB
JoinString
- Inputs:
- string1: STRING
- string2: STRING
- string3: STRING
- string4: STRING
- string5: STRING
- Outputs:
RGBtoHSV
SetMeta
StringAwait
- Inputs:
- message: STRING
- trigger: ARRAY
- Outputs:
TableSelectArray
TableSelectString
Outputs
Nodes that send data to external systems.
View Nodes
AudioOut
LSLOut
MidiCCout
- Inputs:
- cc1: ARRAY
- cc2: ARRAY
- cc3: ARRAY
- cc4: ARRAY
- cc5: ARRAY
- Outputs:
MidiOut
- Inputs:
- note: ARRAY
- velocity: ARRAY
- duration: ARRAY
- Outputs:
OSCOut
SharedMemOut
WriteCsv
ZeroMQOut
Signal
Nodes implementing signal processing operations.
View Nodes
Buffer
Cycle
EMD
FFT
Filter
FOOOFaperiodic
- Inputs:
- Outputs:
- offset: ARRAY
- exponent: ARRAY
- cf_peaks: ARRAY
- cleaned_psd: ARRAY
FrequencyShift
Hilbert
- Inputs:
- Outputs:
- inst_amplitude: ARRAY
- inst_phase: ARRAY
- inst_frequency: ARRAY
IFFT
- Inputs:
- spectrum: ARRAY
- phase: ARRAY
- Outputs:
PSD
Recurrence
- Inputs:
- Outputs:
- recurrence_matrix: ARRAY
- RR: ARRAY
- DET: ARRAY
- LAM: ARRAY
Resample
ResampleJoint
Smooth
StaticBaseline
Threshold
TimeDelayEmbedding
WelfordsZTransform