-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major update: merging develop to master (#217)
* example test commit (#182) * example test commit * example edit * ci: run test workflow on develop branch * ci: add develop branch to job triggers * ci: fix syntax issue in workflow * fix: fixed import (brainflow updated API) * build(deps): locked pylsl==1.10.5 (#187) * Experiment Class Refactor (update to #183), converting specific experiments to subclasses (#184) * First commit * Second commit * Modifications * Lol * Lol * Incorporated N170 and p300, looking good for a PR * ssvep update * Implementing subclasses instead of loose functions * fix: fixed import (brainflow updated API) * Playing around still * Fixing import errors * Adding abstractmethod decorators * Still working on the import error * Guess what's finally working * Comments and naming ticks * More comments * Live coding demonstration * ssvep adapted * Adapting Auditory Oddball * changing save_fn to self.save_fun * This maybe the last big change * utils file changed, changes work through cli Co-authored-by: Erik Bjäreholt <erik@bjareho.lt> * Submodule added for gsoc * Adding pipelines for cli analysis (#202) * started pipelines function * almost working simple function equivalents of nb scripts * fix: fixed import (brainflow updated API) * sqc fixes for unicorn (#176) * Ignore pushes * Trying to create a cli * Stepping through the problem * First commit * Fixing pause in signal quality check * Fixing Signal quality check problem * fix the technical debt * Save path done for automated saving pdf * I feel amazing * Almost through * Update eegnb/cli/__main__.py Co-authored-by: Erik Bjäreholt <erik@bjareho.lt> * Trying to create cli but it's being really painful * Extra word cli error * Changed example handling * Pain * Adding whole datapath * Finally fixed cli * hmm * Looking good * added hyperlink * Having some issues with detecting css and image deltetion * Just the css now * Fixed the css linking problem though it's a weird soln * Automated running, still fnames problem * Hahahah embedded images in html * Improving code * Okay now * Look at that * Almost there just the two figures now * Now * Added attrdict to do with cli error Co-authored-by: John Griffiths <j.davidgriffiths@gmail.com> Co-authored-by: Erik Bjäreholt <erik@bjareho.lt> Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com> * added more options for site args; improved function names; removed some redundant lines (#209) * fix subject num parsing bug * analysis report function improvements for openbci cyton and gtec unicorn devices * run exp fix * Update requirements.txt * fixes to get docs building by github action (#210) * fixes to get docs building by github action * reverted some changes * Update 01r__ssvep_viz.py Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com> * Update README.rst small commit to test doc build workflow on this branch * removing gsoc submodule Co-authored-by: Erik Bjäreholt <erik@bjareho.lt> Co-authored-by: Parv Agarwal <65726543+Parvfect@users.noreply.github.com> Co-authored-by: Parvfect <parvagrw02@gmail.com> Co-authored-by: Ben Pettit <pelleter@gmail.com>
- Loading branch information
1 parent
a225012
commit ac1f5fb
Showing
36 changed files
with
1,155 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ examples/visual_cueing/*.csv | |
.coverage | ||
coverage.xml | ||
htmlcov | ||
|
||
# PyCharm | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "GSOC-eeg-notebooks"] | ||
path = GSOC-eeg-notebooks | ||
url = https://github.com/Parvfect/GSOC-eeg-notebooks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link href="styling.css" rel="stylesheet" /> | ||
<title>Analysis Report</title> | ||
</head> | ||
<body> | ||
<div class="topnav"> | ||
<a href="#Description">Description</a> | ||
<a href="#Raw Epoch">Raw Epoch</a> | ||
<a href="#Stimulus Response">Stimulus Response</a> | ||
</div> | ||
<div id="Description"> | ||
<h1>Analysis Report</h1> | ||
<p> | ||
<b></b>Experiment Name: {} <br> | ||
Subject Id: {} <br> | ||
Session Id: {} <br> | ||
EEG Device: {} <br> | ||
Drop Percentage: {} <br> <br> | ||
This is an analysis report for the experiment. <br> For more information about the experiment, please visit the <a href="https://neurotechx.github.io/eeg-notebooks/">documentation</a> | ||
</p> | ||
</div> | ||
<div id="Raw Epoch"> | ||
<h2>Raw Epoch</h2> | ||
<p> | ||
The raw epoch is shown below. The raw epoch is the data that is recorded from the EEG headset. The raw epoch is then processed to remove noise and artifacts. | ||
</p> | ||
<img src="power_spectrum.png" alt="Raw Epoch" /> | ||
</div> | ||
<div id="Stimulus Response"> | ||
<h2>Stimulus Response</h2> | ||
<p> | ||
The stimulus response is shown below. The stimulus response is the data that is recorded from the EEG headset after removing noise and artifacts. | ||
</p> | ||
<img src="erp_plot.png" alt="Stimulus Response" /> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
|
||
# Generating html using Python | ||
|
||
from airium import Airium | ||
from typing import Dict | ||
import os | ||
import eegnb | ||
import base64 | ||
|
||
a = Airium() | ||
|
||
def get_experiment_information(experiment:str): | ||
analysis_save_path = os.path.join(os.path.dirname(eegnb.__file__), "analysis") | ||
file_path = os.path.join(analysis_save_path, "experiment_descriptions") | ||
|
||
with open(os.path.join(file_path, experiment + ".txt"), 'r') as f: | ||
experiment_text = f.readlines() | ||
|
||
return experiment_text | ||
|
||
def get_img_string(image_save_path): | ||
""" Returns image as string to embed into the html report """ | ||
return base64.b64encode(open(image_save_path, "rb").read()).decode() | ||
|
||
def get_html(experimental_parameters: Dict): | ||
|
||
# add variable to store the link | ||
analysis_save_path = os.path.join(os.path.dirname(eegnb.__file__), "analysis") | ||
css_path = os.path.join(analysis_save_path, "styling.css") | ||
eeg_device, experiment, subject, session, example, drop_percentage, epochs_chosen = experimental_parameters.values() | ||
|
||
erp_image_path = os.path.join(os.getcwd(), "erp_plot.png") | ||
pos_image_path = os.path.join(os.getcwd(), "power_spectrum.png") | ||
|
||
experiment_text = get_experiment_information(experiment) | ||
|
||
|
||
""" Possibility of unique experiment text - decision to be made """ | ||
#experiment_text = "" | ||
#with open('experiment_descriptions/{}.txt'.format(experiment), 'r') as f: | ||
# experiment_text = f.readlines() | ||
|
||
a('<!DOCTYPE html>') | ||
with a.html(): | ||
with a.head(): | ||
a.link(href=css_path, rel='stylesheet', type="text/css") | ||
a.title(_t="Analysis Report") | ||
|
||
with a.body(): | ||
|
||
# Navigation bar | ||
with a.div(klass="topnav"): | ||
a.a(_t="Description", href="#Description") | ||
a.a(_t="Raw Epoch", href="#Raw Epoch") | ||
a.a(_t="Stimulus Response", href="#Stimulus Response") | ||
|
||
# Description | ||
with a.div(id="Description"): | ||
a.h1(_t="Analysis Report") | ||
with a.p(): | ||
a("Experiment Name: {} <br>".format(experiment)) | ||
|
||
if example: | ||
a("Example File <br>") | ||
else: | ||
a("Subject Id: {} <br>".format(subject)) | ||
a("Session Id: {} <br>".format(session)) | ||
|
||
a("EEG Device: {} <br>".format(eeg_device)) | ||
a('This is an analysis report for the experiment. <br> For more information about the experiment, please visit the <a href="https://neurotechx.github.io/eeg-notebooks/">documentation</a><br><br>') | ||
a("{}<br>".format(experiment_text[0])) | ||
a("{}<br>".format(experiment_text[1])) | ||
|
||
# Raw Epoch | ||
with a.div(id="Raw Epoch"): | ||
a.h2(_t="Raw Epoch") | ||
with a.p(): | ||
a("The power spectrum of the raw epoch is displayed below. The raw epoch is then processed to remove noise and artifacts.") | ||
a.img(src="data:image/png;base64, {}".format(get_img_string(pos_image_path)), alt="Raw Epoch") | ||
|
||
# Stimulus Response | ||
with a.div(id="Stimulus Response"): | ||
a.h2(_t="Stimulus Response") | ||
with a.p(): | ||
a("The stimulus response is shown below. The stimulus response is the amplitude response at the specific timescales where the response to the stimulus can be detected. <br>") | ||
a("Epochs chosen: {} <br>".format(epochs_chosen)) | ||
a("Drop Percentage: {} %<br> <br>".format(round(drop_percentage,2))) | ||
a.img(src="data:image/png;base64, {}".format(get_img_string(erp_image_path)), alt="Stimulus Response") | ||
|
||
# Delete the images | ||
os.remove(erp_image_path) | ||
os.remove(pos_image_path) | ||
|
||
# Return the html | ||
return str(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The N170 is a large negative event-related potential (ERP) component that occurs after the detection of faces, but not objects, scrambled faces, or other body parts such as hands. | ||
In the experiment we aim to detect the N170 using faces and houses as our stimuli. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The P300 is a positive event-related potential (ERP) that occurs around 300ms after perceiving a novel or unexpected stimulus. It is most commonly elicited through ‘oddball’ experimental paradigms, where a certain subtype of stimulus is presented rarely amidst a background of another more common type of stimulus. | ||
In the experiment, we aimed to elicit P300 response using a visual oddball stimulation. |
Oops, something went wrong.