-
Notifications
You must be signed in to change notification settings - Fork 125
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
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
1634e81
First commit
Parvfect d48093a
Second commit
Parvfect f05f1c4
Modifications
Parvfect 38993e6
Lol
Parvfect ba01229
Lol
Parvfect 19ffcdc
Merge branch 'parv' into experimentClassFirstRun
Parvfect 42d3f26
Incorporated N170 and p300, looking good for a PR
Parvfect 76c5036
ssvep update
Parvfect dd958d2
Implementing subclasses instead of loose functions
Parvfect f208e08
fix: fixed import (brainflow updated API)
ErikBjare 5db55f3
Playing around still
Parvfect efb1928
Fixing import errors
Parvfect 251d04e
Merge branch 'master' of https://github.com/NeuroTechX/eeg-notebooks …
Parvfect 7436444
Adding abstractmethod decorators
Parvfect ee7cca9
Still working on the import error
Parvfect d73abe0
Guess what's finally working
Parvfect ee5ab09
Comments and naming ticks
Parvfect cb7895b
More comments
Parvfect 4815d28
Live coding demonstration
Parvfect 3ec461a
ssvep adapted
Parvfect b1000bd
Adapting Auditory Oddball
Parvfect d9f53b2
changing save_fn to self.save_fun
Parvfect dc97fb5
This maybe the last big change
Parvfect ef3dba0
utils file changed, changes work through cli
Parvfect File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,24 +7,26 @@ | |
|
||
from eegnb.devices.eeg import EEG | ||
|
||
from eegnb.experiments.visual_n170 import n170 | ||
from eegnb.experiments.visual_p300 import p300 | ||
from eegnb.experiments.visual_ssvep import ssvep | ||
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 aob, diaconescu | ||
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": 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, | ||
} | ||
|
||
|
@@ -42,7 +44,15 @@ def run_experiment( | |
): | ||
if experiment in experiments: | ||
module = experiments[experiment] | ||
module.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn) # type: ignore | ||
|
||
# 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() | ||
Comment on lines
+49
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() |
||
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:") | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
Just becomes