Visualises a single EGG signal dataset from an m x n numpy ndarray
@@ -852,7 +963,7 @@
Returns
baseline : np.ndarray = None,
significance_level:float = 0.05,
make_legend = False,
- ax = None ) -> None:
+ ax = None ) -> np.ndarray:
"""
Visualises a single EGG signal dataset from an `m x n numpy ndarray`
with `m` repeated datasets and `n` entries per set. It generates a solid
@@ -989,9 +1100,10 @@
Index
-
+
compare_signals
difference_plot
+get_unit_scale
mean
plot_signal
sem
diff --git a/docs/EEGToolkit/auxiliary/auxiliary.html b/docs/EEGToolkit/auxiliary/auxiliary.html
index ab5090d..58d3168 100644
--- a/docs/EEGToolkit/auxiliary/auxiliary.html
+++ b/docs/EEGToolkit/auxiliary/auxiliary.html
@@ -30,11 +30,20 @@ Module EEGToolkit.auxiliary.auxiliary
"""
Auxiliary functions to work within the streamlit environment
"""
+import sys
+import os
-from ..EEGData import EEGData, supported_filetypes
import streamlit as st
from copy import deepcopy
-import os
+
+try:
+ from EEGToolkit.EEGData import EEGData, supported_filetypes
+except ImportError:
+ abspath = os.path.abspath(__file__)
+ dname = os.path.dirname(os.path.dirname(abspath))
+ sys.path.append(dname)
+
+ from EEGData import EEGData, supported_filetypes
class Session:
"""
diff --git a/docs/EEGToolkit/index.html b/docs/EEGToolkit/index.html
index e7728e6..8d55eda 100644
--- a/docs/EEGToolkit/index.html
+++ b/docs/EEGToolkit/index.html
@@ -102,7 +102,11 @@ CLI
```
"""
from .EEGData import *
-from .EEGStats import *
+from .EEGStats import *
+
+__pdoc__ = {
+ "EEGToolkit.test_procedure": False
+ }
@@ -120,11 +124,6 @@
-EEGToolkit.main
-
-This script defines an interactive
-web-app for the EEGData package.
-
diff --git a/presentation/beluga.png b/presentation/beluga.png
new file mode 100644
index 0000000..8b20478
Binary files /dev/null and b/presentation/beluga.png differ
diff --git a/presentation/pres.ipynb b/presentation/pres.ipynb
new file mode 100644
index 0000000..70068a5
--- /dev/null
+++ b/presentation/pres.ipynb
@@ -0,0 +1,204 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# EEGToolkit \n",
+ "### A small python package to quickly provide first insights into EEG data from reaction-time delay experiments.\n",
+ "\n",
+ "Axel Giottonini, Noah Kleinschmidt, Kalvin Dobler\n",
+ "\n",
+ "\n",
+ "AdvPy Project, FS 2022\n",
+ "\n",
+ "---"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The package can be installed via `pip` directly via the TestPyPI package index:\n",
+ "\n",
+ "```bash\n",
+ "\n",
+ "pip install -i https://test.pypi.org/simple/ EEGToolkit\n",
+ "\n",
+ "```"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Groundwork\n",
+ "\n",
+ "- Inputs are two datafiles specifying EEG recorded signal data, and accompanying time-event metadata.\n",
+ " - multiple filetypes are supported (`csv, tsv, txt, npy`)\n",
+ "- Timeframe-Windows are extracted around all specified event timepoints (from the metadata)\n",
+ "- Position-wise T-Tests compare signal differences \n",
+ " - between different types of events\n",
+ " - within the same type of event across replicates, against the event's baseline signal\n",
+ "- Output is a summary figure of the conducted T-Tests\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The figure layout is adjusted by the number of different types of events that were recorded. (Here we replicated the original metadata several times, so some of the signals are identical...)\n",
+ "\n",
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Usage\n",
+ "\n",
+ "The foundation is an `API` centered on the `EEGData` class which handles file reading, and summarising the output, using class methods and additional functions. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import EEGToolkit as eeg\n",
+ "\n",
+ "# setup the EEGData object\n",
+ "e = eeg.EEGData( \n",
+ " signal_path = \"./data/eeg.txt\", \n",
+ " event_path = \"./data/events.tsv\", \n",
+ " sampling_frequency = 500 \n",
+ " )\n",
+ "\n",
+ "# extract event time-windows\n",
+ "e.extract( start_sec = -0.5, stop_sec = 1.2 )\n",
+ "\n",
+ "# perform baseline comparison for each signal\n",
+ "e.baseline()\n",
+ "\n",
+ "# change the labelling scales of the data\n",
+ "timescale = 1000 # milliseconds\n",
+ "signalscale = 1000 # millivolts\n",
+ "\n",
+ "# generate a summary figure\n",
+ "e.summary( x_scale = timescale, y_scale = signalscale )"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "For quicker processing we added a `CLI` which can directly be accessed from the terminal as \n",
+ "\n",
+ "```bash\n",
+ "EEGToolkit --eeg ./data/eeg.txt --event ./data/events.tsv -f 500 -s -0.5 -e 1.2\n",
+ "```"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "For people who don't like working with CLIs so much, we also offer a `GUI` which can be activated using the CLI option `-i`\n",
+ "\n",
+ "```bash\n",
+ "EEGToolkit -i\n",
+ "```"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Further ideas\n",
+ "The first improvement that should be done, would be to implement a module for signal preprocessing. Such module could be developed partially with the `scipy` library and the various processing methods it offers. \n",
+ "\n",
+ "To go further with our project, we could extend the EEGData class to support multiple EEG signals, thus working on the signals in different position of the scalp.\n",
+ "\n",
+ "With such extension we could also develop topological and tomographical tools using libraries dedicated to the subject such as [`visbrain`](http://visbrain.org/)\n",
+ "\n",
+ "Finally we could create statistical tools to compare the responses between subjects.\n",
+ "\n",
+ "Out of the scope of the base project, the support for other brain imaging technologies such as fNIRS or fMRI could be implemented. Implementing theese methods would require the use of a GLM instead of the averaging done with EEG and a more sophisticated preprocessing should also be implemented.\n",
+ "\n",
+ "Great examples of what is now implemented for neuroimaging is presented on [nipy.org](https://nipy.org/) !"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class EEGDataCollection(EEGData):\n",
+ "\n",
+ " def __init__(self,\n",
+ " signal_paths: list[str],\n",
+ " positions: list[tuple[float, float, float]] | np.ndarray,\n",
+ " event_path: str,\n",
+ " sampling_frequency: float,\n",
+ " **kwargs) -> None:\n",
+ "\n",
+ " # Verification to assert that the input values are valid...\n",
+ "\n",
+ " self.signals = [super().__init__(el, event_path, sampling_frequency, kwargs) for el in signal_paths]\n",
+ " self.positions = positions\n",
+ "\n",
+ " # Verification to assert that the elements of the collection are obtained from the same experiment...\n",
+ "\n",
+ "\n",
+ " def extract(self,\n",
+ " start_sec:float,\n",
+ " stop_sec:float,\n",
+ " event_type : ( int or tuple or list or np.ndarray ) = None, \n",
+ " **kwargs) -> np.ndarray:\n",
+ "\n",
+ " self._data = np.stack([signal.extract(start_sec, stop_sec, event_type, kwargs) for signal in self.signals], axis=-1)\n",
+ " return self._data\n",
+ " \n",
+ " # ..."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/setup.py b/setup.py
index 4cd8ce8..5a33a90 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
setuptools.setup(
name="EEGToolkit",
- version="2.0.0",
+ version="2.0.3",
author="Axel Giottonini, Noah Kleinschmidt, Kalvin Dobler",
author_email="axel.giottonini@unifr.ch, noah.kleinschmidt@students.unibe.ch, kalvin.dobler@unifr.ch",
description="A package for EEG data analysis of reaction time-delay experiments.",
diff --git a/test.pdf b/test.pdf
index d87cb4f..6b11ab4 100644
Binary files a/test.pdf and b/test.pdf differ
diff --git a/test.png b/test.png
new file mode 100644
index 0000000..0f0e8de
Binary files /dev/null and b/test.png differ
diff --git a/test_extended.png b/test_extended.png
new file mode 100644
index 0000000..a029561
Binary files /dev/null and b/test_extended.png differ