Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment Class Refactor (update to #183), converting specific experiments to subclasses #184

Merged
merged 24 commits into from
Aug 10, 2022

Conversation

Parvfect
Copy link
Collaborator

@Parvfect Parvfect commented Jun 15, 2022

As per the comments left in PR #183, Sub classes make more sense for increasing modular support and as a general framework. I've implemented the base Experiment Class and the Experiment Subclasses for Visual P300, N170 and SSVEP (although I can rewrite some of the code in SSVEP and make it better). Next step is running it and making sure it works the same, I'm having some trouble in downloading the psychopy package due to my Python version and I should get that done very soon. Wanted to put this through so we could talk about it in the dev meeting.

Changes as per the project proposal for Google Summer of Code for eeg-notebooks - https://summerofcode.withgoogle.com/programs/2022/projects/2baQ46dm.

Implemented as a part of the GSOC period for EEG - Notebooks under the mentorship of John Griffiths.

@Parvfect
Copy link
Collaborator Author

Parvfect commented Jun 27, 2022

Right so the Visual P300 and the Visual N170 works although its a bit different,

'''
from eegnb.experiments.visual_n170 import n170
t = n170.VisualN170()
t.present()

''''

That should run it.

A few things worth pointing out,

  1. I have changed how the windows work, previously two mywin instances were used to show instructions and present whereas I have reused the first one - don't know if this is ideal and need some advice.
  2. I have a shit ton of self parameters to share variables across functions and I don't know if that's fun for someone new who tries to create an experiment from this structure -> might need to be discussed
  3. There are some bits of ugly code here and there that I am going to clean in the next few days
  4. Some inputs in some of the files seem redundant if it's importing the Experiment Class

Copy link
Collaborator

@JohnGriffiths JohnGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall: like this a lot. Seems to run successfully from tests I have done so far. New structure is good.

Several specific suggestions and requests in the code.

General request:

A lot more in-code comments + annotation + documentation.

def present(self):
""" Do the present operation for a bunch of experiments """

self.setup()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, let's add an argument here so that instructions can optionally be skipped. Default behaviour should be to show however.

# Offset
core.wait(self.soa)
self.mywin.flip()
if len(event.getKeys()) > 0 or (time() - start) > self.record_duration:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also as discussed, this part (of the original code) has always looked a bit ugly to me. The alternative is to pre-calculate all of the itis, soas, jitters in advance, and then it will be known before the loop starts what the duration will be, and so the decision of whether or it is the duration param or the completion of the trial set will be clear and not determined on the fly at the end.

However, I suggest we have a stab at this small adjustment at a later point, it isn't the focus or priority of the current PR.

@@ -17,107 +17,39 @@
from eegnb import generate_save_fn
from eegnb.devices.eeg import EEG
from eegnb.stimuli import FACE_HOUSE
from eegnb.experiments.Experiment import Experiment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having both the file name and the module name the exact same text (Experiment) may be common but is not clean.

I think the experiment base class should be called something like `BaseExperiment'

Also I think we should import the final experiment classes into the init so that they can be imported more cleanly at the user level.

So the final use pattern would be something like

from eegnb.experiments import VisualN170
expt = VisualN170()
expt.present()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A problem with this is that the file VisualN170 is super buried in the folders, I don't mind bringing all the experiments out of their specific folder so this is possible but need to make sure it does not cause any other problems.

from eegnb import generate_save_fn
from eegnb.devices.eeg import EEG

class Experiment:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment below. I think

class ExperimentBase

or

class BaseExperiment

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the other experiments are named P300Experiment for example, then it should prob be BaseExperiment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you guys, gonna change it to BaseExperiment
I faced some namespace errors when trying to get rid of the redundant imports so this would need to be done anyway.

f"No path for a save file was passed to the experiment. Saving data to {self.save_fn}"
)

def present(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't like the name present for this method. Never did.

I think this 'run experiment' method should be

def run(self):

this would also help avoid any confusion with the present_stimulus method

Copy link
Collaborator

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Just had a few naming nits :)

mywin = visual.Window([1600, 900], monitor="testMonitor", units="deg", fullscr=True)
mywin.mouseVisible = False
#mywin = visual.Window([1600, 900], monitor="testMonitor", units="deg", fullscr=True)
self.mywin.mouseVisible = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name it window instead of mywin

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


def present_stimulus(self):
def present_stimulus(self, ii):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think idx is a better name than ii (which I've seen used for vectors), type annotation would also help :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, done

@Parvfect
Copy link
Collaborator Author

Parvfect commented Jul 6, 2022

Have adressed the comments given above and made the naming changes.
Two issues still remaining

  1. For importing experiments directly the files will have to be removed from their folders that is from (VisualN170/n170.py) to just the file. Don't think this should cause any complications but need to make sure this is what is needed .
  2. I can't seem to get rid of the redundant imports in the specific experiments by putting in the BaseExperiment class, if anyone can help with that it would be lovely.

Besides that I think I should be good to go and start changing the other Experiments for this style, just need a nod from John to start it.

@Parvfect Parvfect marked this pull request as ready for review July 7, 2022 19:44
@JohnGriffiths
Copy link
Collaborator

Getting error with this.

Running

eegnb runexp -ip muse2_bfn

Gives

Traceback (most recent call last):
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\Scripts\eegnb-script.py", line 33, in <module>
    sys.exit(load_entry_point('eeg-notebooks', 'console_scripts', 'eegnb')())
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "c:\users\eeg_lab\code\github\eeg-notebooks_dev\eeg-notebooks_reviewpr184\eegnb\cli\__main__.py", line 80, in runexp
    run_experiment(experiment, eeg, recdur, outfname)
  File "c:\users\eeg_lab\code\github\eeg-notebooks_dev\eeg-notebooks_reviewpr184\eegnb\cli\utils.py", line 45, in run_experiment
    module.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn)  # type: ignore
AttributeError: module 'eegnb.experiments.visual_n170.n170' has no attribute 'present'

@Parvfect
Copy link
Collaborator Author

Getting error with this.

Running

eegnb runexp -ip muse2_bfn

Gives

Traceback (most recent call last):
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\Scripts\eegnb-script.py", line 33, in <module>
    sys.exit(load_entry_point('eeg-notebooks', 'console_scripts', 'eegnb')())
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "c:\users\eeg_lab\code\github\eeg-notebooks_dev\eeg-notebooks_reviewpr184\eegnb\cli\__main__.py", line 80, in runexp
    run_experiment(experiment, eeg, recdur, outfname)
  File "c:\users\eeg_lab\code\github\eeg-notebooks_dev\eeg-notebooks_reviewpr184\eegnb\cli\utils.py", line 45, in run_experiment
    module.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn)  # type: ignore
AttributeError: module 'eegnb.experiments.visual_n170.n170' has no attribute 'present'

So this is because we changed our present function to run. Additionally, the runexp script will need to be modified because the usage is not eegnb.experiments.visual_n170.n170 anymore and we have to initalize a class object first of the form,

'from eegnb.devices.eeg import EEG
from eegnb.experiments import VisualN170, VisualP300, VisualSSVEP, AuditoryOddball

if name == "main":
board_name = 'muse2'

record_duration = 120
eeg_device = EEG(device=board_name)
t = AuditoryOddball(duration=record_duration, eeg=eeg_device)
t.run() 

'

I'm not too sure where the runexp file is, I'll try finiding it right now so I can make the necessary changes.

@Parvfect
Copy link
Collaborator Author

Okay so I tested each experiment changed (VisualN170, VisualP300, VisualSSVEP and AuditoryOddball) using the Muse2 and a script importing them directly rather than through runexp. They all seem to be functional, no errors and running smooth. There seems to be a slight delay from the spacebar of the instruction screen to the displaying of images, which I assume is setting up the eeg-stream, but it's definitely longer than normal and I'll need another pair of eyes on it to see if it's a problem.

As of now, I need to fix the cli usage of it as John has shown above and more robust tests for making sure everything is working as we need. I also have not been able to test this through the Brainflow, have been using Bluemuse.

@Parvfect
Copy link
Collaborator Author

Parvfect commented Aug 3, 2022

Getting error with this.
Running

eegnb runexp -ip muse2_bfn

Gives

Traceback (most recent call last):
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\Scripts\eegnb-script.py", line 33, in <module>
    sys.exit(load_entry_point('eeg-notebooks', 'console_scripts', 'eegnb')())
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\eeg_lab\.conda\envs\eeg-notebooks\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "c:\users\eeg_lab\code\github\eeg-notebooks_dev\eeg-notebooks_reviewpr184\eegnb\cli\__main__.py", line 80, in runexp
    run_experiment(experiment, eeg, recdur, outfname)
  File "c:\users\eeg_lab\code\github\eeg-notebooks_dev\eeg-notebooks_reviewpr184\eegnb\cli\utils.py", line 45, in run_experiment
    module.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn)  # type: ignore
AttributeError: module 'eegnb.experiments.visual_n170.n170' has no attribute 'present'

So this is because we changed our present function to run. Additionally, the runexp script will need to be modified because the usage is not eegnb.experiments.visual_n170.n170 anymore and we have to initalize a class object first of the form,

'from eegnb.devices.eeg import EEG from eegnb.experiments import VisualN170, VisualP300, VisualSSVEP, AuditoryOddball

if name == "main": board_name = 'muse2'

record_duration = 120
eeg_device = EEG(device=board_name)
t = AuditoryOddball(duration=record_duration, eeg=eeg_device)
t.run() 

'

I'm not too sure where the runexp file is, I'll try finiding it right now so I can make the necessary changes.

Fixed this in new commit. Please note that an if condition had to be added for the new calling style that can be made cleaner if all the experiments are adapted.

Code looks like this (eegnb/cli/utils.py) for initialization

from eegnb.experiments import VisualN170
from eegnb.experiments import VisualP300
from eegnb.experiments import VisualSSVEP
from eegnb.experiments import AuditoryOddball
from eegnb.experiments.visual_cueing import cueing
from eegnb.experiments.visual_codeprose import codeprose
from eegnb.experiments.auditory_oddball import diaconescu
from eegnb.experiments.auditory_ssaep import ssaep, ssaep_onefreq


# New Experiment Class structure has a different initilization, to be noted
experiments = {
    "visual-N170": VisualN170(),
    "visual-P300": VisualP300(),
    "visual-SSVEP": VisualSSVEP(),
    "visual-cue": cueing,
    "visual-codeprose": codeprose,
    "auditory-SSAEP orig": ssaep,
    "auditory-SSAEP onefreq": ssaep_onefreq,
    "auditory-oddball orig": AuditoryOddball(),
    "auditory-oddball diaconescu": diaconescu,
}

and for the running,

def run_experiment(
    experiment: str, eeg_device: EEG, record_duration: float = None, save_fn=None
):
    if experiment in experiments:
        module = experiments[experiment]

        # Condition added for different run types of old and new experiment class structure
        if experiment == "visual-N170" or experiment == "visual-P300" or experiment == "visual-SSVEP" or experiment == "auditory-oddball orig":
            module.duration = record_duration
            module.eeg = eeg_device
            module.save_fn = save_fn
            module.run()
        else:
            module.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn)  # type: ignore
    else:
        print("\nError: Unknown experiment '{}'".format(experiment))
        print("\nExperiment can be one of:")
        print("\n".join([" - " + exp for exp in experiments]))

@Parvfect
Copy link
Collaborator Author

Parvfect commented Aug 4, 2022

For Reviewer

Test each experiment (Visual N170, Visual P300, Auditory Oddball, Visual SSVEP) using the CLI
using the EEG (already working without)

eegnb runexp -ip

There seems to be a slight delay between the instruction screen and running the experiments that is bothering me, really need someone to confirm that it's alright. Besides that everything else seems alright.

@JohnGriffiths
Copy link
Collaborator

This isn't working for me. I get 1 image in the sequence shown, then it closes down immediately. Tried for Muse 2016 and Muse S on Windows 10 ( I think). Trying to get to the bottom of it.

@Parvfect
Copy link
Collaborator Author

Parvfect commented Aug 5, 2022

This isn't working for me. I get 1 image in the sequence shown, then it closes down immediately. Tried for Muse 2016 and Muse S on Windows 10 ( I think). Trying to get to the bottom of it.

Send me any error messages or outputs if you can, could look into it and find out more.

@JohnGriffiths
Copy link
Collaborator

JohnGriffiths commented Aug 9, 2022

Ok, apols for false alarm. This appears to be working ok for me now. Tested for museS and muse2016 on two windows 10 comps, with brainflow native device option.

I agree that the wait period between pressing space and the experiment starting seems a bit long. I wonder if that can be sped up?

If that is difficult then the message could be adjusted to something like

'please press space and experiment will begin in a few seconds'

Haven't yet checked that the ERPs recorded with this look ok. No real reason why they shouldn't but is obvs super important that that is confirmed. Will get to that asap.

Will do a final review of code changes shortly, and if all is good then I am good to merge this PR.

@JohnGriffiths
Copy link
Collaborator

Merging to dev.

@JohnGriffiths JohnGriffiths merged commit e4e7d8a into develop Aug 10, 2022
Copy link
Collaborator

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this merged! Just had a few comments.

Comment on lines +49 to +53
if experiment == "visual-N170" or experiment == "visual-P300" or experiment == "visual-SSVEP" or experiment == "auditory-oddball orig":
module.duration = record_duration
module.eeg = eeg_device
module.save_fn = save_fn
module.run()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be replaced with:

if isinstance(experiment, BaseExperiment.__class__):
    exp = experiment(eeg=eeg, duration=record_duration, save_fn=save_fn)
    exp.run()

Comment on lines 21 to 30
experiments = {
"visual-N170": n170,
"visual-P300": p300,
"visual-SSVEP": ssvep,
"visual-N170": VisualN170(),
"visual-P300": VisualP300(),
"visual-SSVEP": VisualSSVEP(),
"visual-cue": cueing,
"visual-codeprose": codeprose,
"auditory-SSAEP orig": ssaep,
"auditory-SSAEP onefreq": ssaep_onefreq,
"auditory-oddball orig": aob,
"auditory-oddball orig": AuditoryOddball(),
"auditory-oddball diaconescu": diaconescu,
Copy link
Collaborator

@ErikBjare ErikBjare Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should not be instantiated globally, just leave the class in the dict and let the caller handle initialization.

So that, for example:

    "visual-N170": VisualN170(),

Just becomes

    "visual-N170": VisualN170,

Comment on lines +14 to +15
prefs.hardware['audioLib'] = 'PTB'
prefs.hardware['audioLatencyMode'] = 3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these safe to set globally? @JohnGriffiths

Feels like we set them like this in more places, in which case they would conflict.

Edit: Indeed, but looks like they all set the same values? Should prob be consolidated. All hits: https://github.com/NeuroTechX/eeg-notebooks/search?q=prefs.hardware

ErikBjare added a commit to ErikBjare/eeg-notebooks that referenced this pull request Sep 30, 2022
…ific experiments to subclasses (NeuroTechX#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>
JohnGriffiths added a commit that referenced this pull request Jan 19, 2023
* 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>
oreHGA added a commit that referenced this pull request Mar 4, 2023
* 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>

* update dependencies - seaborn

* docs/perf: reduced the imports: `cueing` example

* bug: update deprecated `plot_psd()` method

- feature of new `mne` version.
- instead of doing plot_psd() from the `mne.io.Raw` object, must do this:
	- `raw.compute_psd().plot()`
	- i.e., has to pass through a `spectrum` object

* updated deprec. `mne` function

* perf: removed importage of unused packages from example
- One of them, i.e., `collections.Iterable` is even deprecated.
- Must use `collections.abc.Iterable` instead now.
- Resulting in faster build/user run

* bugfix: `plot_conditions` - due to `sns` deprecation

* bugfix: resolved `psd_welch()` deprecation (`mne`)

---------

Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com>
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>
Co-authored-by: Taha Morshedzadeh <taha.morshedzadeh@neuromatch.io>
oreHGA added a commit that referenced this pull request Mar 10, 2023
…Refactor (#218)

* 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>

* Updated doc examples

* Update 00x__n170_run_experiment.py

fix: typo in func param

---------

Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com>
Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>
Co-authored-by: Ben Pettit <pelleter@gmail.com>
Co-authored-by: Ore O <oreogundipe@gmail.com>
JohnGriffiths added a commit that referenced this pull request Jun 21, 2024
* 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

* ci: update python to 3.8, update wxPython, update setup-python action

* ci: pin ubuntu versions to 22.04, updated wxPython urls

* ci: bumped psychopy to 2023.1.0

* build(deps): set upper supported numpy version to 1.23.x

* chore: applied no_implicit_optional

* update dependencies - for build (#220)

* 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>

* update dependencies - seaborn

* docs/perf: reduced the imports: `cueing` example

* bug: update deprecated `plot_psd()` method

- feature of new `mne` version.
- instead of doing plot_psd() from the `mne.io.Raw` object, must do this:
	- `raw.compute_psd().plot()`
	- i.e., has to pass through a `spectrum` object

* updated deprec. `mne` function

* perf: removed importage of unused packages from example
- One of them, i.e., `collections.Iterable` is even deprecated.
- Must use `collections.abc.Iterable` instead now.
- Resulting in faster build/user run

* bugfix: `plot_conditions` - due to `sns` deprecation

* bugfix: resolved `psd_welch()` deprecation (`mne`)

---------

Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com>
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>
Co-authored-by: Taha Morshedzadeh <taha.morshedzadeh@neuromatch.io>

* Updated psychopy (#215)

* update psychopy for psychxr compatibility

* updated n170 example to run again.

* Updated doc examples for N170, P300 and SSVEP after Experiment Class Refactor (#218)

* 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>

* Updated doc examples

* Update 00x__n170_run_experiment.py

fix: typo in func param

---------

Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com>
Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>
Co-authored-by: Ben Pettit <pelleter@gmail.com>
Co-authored-by: Ore O <oreogundipe@gmail.com>

* fix error breaking n170 test (#223)

* fixed requirements.txt so 'pip install -e .' would work on windows. (#229)

* Get CI test builds working again! (#170)

* Revert "Revert PR #167: "ci: fix broken CI" (#169)"

This reverts commit 2d74871.

* Update Makefile

* fix: Update vep.py import

* Update Makefile

* Update vep.py

* fix: typo in makefile

* fix: update BaseExperiment class reference

* Update Makefile

* Update vep.py

* Update 01r__n170_viz.py

* makefile: install libnotify4

---------

Co-authored-by: Ore O <oreogundipe@gmail.com>

* fix macos build (#245)

* Add devcontainer configuration for CPU environment

* Fixed the python version needed

* Fix plot conditions (#257)

* fixed plot_conditions functoni issues

* small change to viz n170 plotting example

* small change to viz p300 plotting example

* fixed to plotting issue

* modify plot command

* update example files

* fix condition label bug

* fix: set layout engine to fix colorbar error

---------

Co-authored-by: Ore O <oreogundipe@gmail.com>

* Started the name switch (#251)

* started renaming from eegnb to eegexpy

* more eegnb renaming work

* more eegnb switches

* more relabelling

* ssvep renamings

* cueing eg

* update for more misc files

* more of the same

* update

* Update and rename available_notebooks.md to available_experiments.md

* Add newlogo (#260)

* Add files via upload

* Update README.rst

* added to enable eegexpy commands (#265)

* started alias of main package for imports (#266)

* Add multiple installation options (#263)

* added newly separated analysis and streaming utils files

* modified setup and requirements to allow for optional install types

* updated imports in experiment examples

* fixed some typos

* Update requirements.txt

moved click library to stim pres requirements section

* Update requirements.txt

Co-authored-by: Taha Morshedzadeh <t.morshedzadeh@mail.utoronto.ca>

* Update Makefile

* Update docs.yml

* Update Makefile

this does a full build with all dependencies for EEG-ExPy

---------

Co-authored-by: Ore O <oreogundipe@gmail.com>
Co-authored-by: Taha Morshedzadeh <t.morshedzadeh@mail.utoronto.ca>

* Add support for /develop in docs site (#259)

* feat: update action to build doc page in a folder

* test: see if it works without if clause

* test: change source for docs

* Initial support for VR headsets (#241)

* fixed requirements.txt so 'pip install -e .' would work on windows.

* added support for n170 to run on rift

* altered logic to add back in jitter

* simplified logic

* made fullscreen again

* further simplified logic

* decreased font size of instructions for vr

* fixed instructions display, further simplified logic, removed logs

* made code easier to read

* reverted board back to muse

* Enable headlocking to fix jittering - cancel out any rotation and translation coming from the headset.

* fixed use_vr parameter to be set to False by default for existing experiments.

* fix macos build

* reverted unnecessary changes and made p300 experiment display correctly

* added vr support for p300 and ssvep

* fix psychxr version

* adding vr doc

* updated vr doco

---------

Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com>

* ssaep volumefadingfixes (#81)

* fixed duration on instructions screen

* put sound object instantiation inside trials loop. fixes sound fading issue

---------

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>
Co-authored-by: Ore Ogundipe <oreogundipe@gmail.com>
Co-authored-by: Taha Morshedzadeh <taha.morshedzadeh@neuromatch.io>
Co-authored-by: Ben Pettit <benpettit@digimulti.com>
Co-authored-by: Taha Morshedzadeh <t.morshedzadeh@mail.utoronto.ca>
oreHGA pushed a commit that referenced this pull request Aug 2, 2024
…iments 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants