NeuroTechX / EEG-ExPy

EEG Experiments in Python
https://neurotechx.github.io/EEG-ExPy/
BSD 3-Clause "New" or "Revised" License
437 stars 124 forks source link

Implement ExperimentSpec to reduce redundancy #76

Open ErikBjare opened 3 years ago

ErikBjare commented 3 years ago

A lot of the code/experiments needs access to static information such as:

It would probably be a good idea to add a dataclass for this, that'll be easier to pass around without having to repeat the same set of arguments every time.

The idea would be that once you've constructed a ExperimentSpec, you can:

Essentially:


@dataclass
class ExperimentSpec:
    device_name: str
    experiment_name: str
    subject_id: int
    session_id: int
    device_options: dict = field(default_factory=dict, ...)

    def __post_init__(self):
        self.device = EEG(self.device_name, **self.device_options)

    def run() -> None:
        ...

    def get_output_file() -> Path: 
        ...
JadinTredup commented 3 years ago

This can maybe be implemented with a simple configuration files instead of starting a whole new dataclass but perhaps being able to do things like expspec.run() might be useful so I will play around with this.