From 53154c2f32fb286457d537f438bca4f62620e639 Mon Sep 17 00:00:00 2001 From: Parv Agarwal <65726543+Parvfect@users.noreply.github.com> Date: Fri, 10 Mar 2023 12:41:00 +0000 Subject: [PATCH] Updated doc examples for N170, P300 and SSVEP after Experiment Class Refactor (#218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * 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 * 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 Co-authored-by: Erik Bjäreholt Co-authored-by: John Griffiths * 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 * Update README.rst small commit to test doc build workflow on this branch * removing gsoc submodule Co-authored-by: Erik Bjäreholt Co-authored-by: Parv Agarwal <65726543+Parvfect@users.noreply.github.com> Co-authored-by: Parvfect Co-authored-by: Ben Pettit * Updated doc examples * Update 00x__n170_run_experiment.py fix: typo in func param --------- Co-authored-by: John Griffiths Co-authored-by: Erik Bjäreholt Co-authored-by: Ben Pettit Co-authored-by: Ore O --- .../visual_n170/00x__n170_run_experiment.py | 26 +++++++++---------- .../visual_p300/00x__p300_run_experiment.py | 10 ++++--- .../visual_ssvep/00x__ssvep_run_experiment.py | 7 ++--- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/examples/visual_n170/00x__n170_run_experiment.py b/examples/visual_n170/00x__n170_run_experiment.py index d0cf1f02..dddaf6dc 100644 --- a/examples/visual_n170/00x__n170_run_experiment.py +++ b/examples/visual_n170/00x__n170_run_experiment.py @@ -12,25 +12,25 @@ # --------------------- # # Imports +from eegnb import generate_save_fn from eegnb.devices.eeg import EEG from eegnb.experiments import VisualN170 # Define some variables +board_name = "muse2" # board name +experiment_name = "visual_n170" # experiment name +subject_id = 0 # test subject id +session_nb = 0 # session number +record_duration = 120 # recording duration -# Experiment type -experiment = VisualN170() - -# EEG device -experiment.eeg = EEG(device="cyton") # "muse") +# generate save path +save_fn = generate_save_fn(board_name, experiment_name, subject_id, subject_nb) -# Test subject id -subject_id = 0 +# create device object +eeg_device = EEG(device=board_name) -# Session number -session_nb = 0 - -# Experiment recording duration -experiment.duration = 120 +# Experiment type +experiment = VisualN170(duration=record_duration, eeg=eeg_device, save_fn=save_fn) ################################################################################################### # Run experiment @@ -39,4 +39,4 @@ experiment.run() # Saved csv location -print(experiment.save_fn) +print("Recording saved in", experiment.save_fn) diff --git a/examples/visual_p300/00x__p300_run_experiment.py b/examples/visual_p300/00x__p300_run_experiment.py index 8edcdbfd..754f5340 100644 --- a/examples/visual_p300/00x__p300_run_experiment.py +++ b/examples/visual_p300/00x__p300_run_experiment.py @@ -15,10 +15,10 @@ import os from eegnb import generate_save_fn from eegnb.devices.eeg import EEG -from eegnb.experiments.visual_p300 import p300 +from eegnb.experiments import VisualP300 # Define some variables -board_name = "muse" +board_name = "muse2" experiment = "visual_p300" subject_id = 0 session_nb = 0 @@ -38,5 +38,7 @@ ################################################################################################### # Run experiment # --------------------- -# -p300.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn) +# +# Create Experiment Object +p300 = VisualP300(duration=record_duration, eeg=eeg_device, save_fn=save_fn) +p300.run() diff --git a/examples/visual_ssvep/00x__ssvep_run_experiment.py b/examples/visual_ssvep/00x__ssvep_run_experiment.py index 1741760e..dfb8c046 100644 --- a/examples/visual_ssvep/00x__ssvep_run_experiment.py +++ b/examples/visual_ssvep/00x__ssvep_run_experiment.py @@ -15,10 +15,10 @@ import os from eegnb import generate_save_fn from eegnb.devices.eeg import EEG -from eegnb.experiments.visual_ssvep import ssvep +from eegnb.experiments import VisualSSVEP # Define some variables -board_name = "muse" +board_name = "muse2" experiment = "visual_ssvep" subject_id = 0 session_nb = 0 @@ -39,4 +39,5 @@ # Run experiment # --------------------- # -ssvep.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn) +ssvep = VisualSSVEP(duration=record_duration, eeg=eeg_device, save_fn=save_fn) +ssvep.run() \ No newline at end of file