Skip to content

Commit

Permalink
chore: applied no_implicit_optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Mar 3, 2023
1 parent c2c5d57 commit adf5e28
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 19 deletions.
19 changes: 10 additions & 9 deletions eegnb/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from eegnb.devices.eeg import EEG
from eegnb.analysis.utils import check_report
from eegnb.analysis.pipelines import load_eeg_data, make_erp_plot, analysis_report, example_analysis_report
from typing import Optional


@click.group(name="eegnb")
Expand All @@ -31,10 +32,10 @@ def main():
)
def runexp(
experiment: str,
eegdevice: str = None,
macaddr: str = None,
recdur: float = None,
outfname: str = None,
eegdevice: Optional[str] = None,
macaddr: Optional[str] = None,
recdur: Optional[float] = None,
outfname: Optional[str] = None,
prompt: bool = False,
dosigqualcheck = True,
generatereport = True
Expand Down Expand Up @@ -107,11 +108,11 @@ def askforreportcheck():
)
def create_analysis_report(
experiment: str,
eegdevice: str = None,
subject: str = None,
session: str = None,
site: str = None,
filepath:str = None,
eegdevice: Optional[str] = None,
subject: Optional[str] = None,
session: Optional[str] = None,
site: Optional[str] = None,
filepath: Optional[str] = None,
prompt: bool = False,
):
"""
Expand Down
3 changes: 2 additions & 1 deletion eegnb/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from eegnb.experiments.visual_codeprose import codeprose
from eegnb.experiments.auditory_oddball import diaconescu
from eegnb.experiments.auditory_ssaep import ssaep, ssaep_onefreq
from typing import Optional


# New Experiment Class structure has a different initilization, to be noted
Expand All @@ -40,7 +41,7 @@ def get_exp_desc(exp: str):


def run_experiment(
experiment: str, eeg_device: EEG, record_duration: float = None, save_fn=None
experiment: str, eeg_device: EEG, record_duration: Optional[float] = None, save_fn=None
):
if experiment in experiments:
module = experiments[experiment]
Expand Down
3 changes: 2 additions & 1 deletion eegnb/experiments/auditory_oddball/aMMN.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from psychopy import visual, core, event, sound

from eegnb import generate_save_fn
from typing import Optional


def present(
save_fn: str = None,
save_fn: Optional[str] = None,
duration=120,
stim_types=None,
itis=None,
Expand Down
3 changes: 2 additions & 1 deletion eegnb/experiments/auditory_oddball/aob.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from time import time
from eegnb.devices.eeg import EEG
from eegnb.experiments import Experiment
from typing import Optional


class AuditoryOddball(Experiment.BaseExperiment):

def __init__(self, duration=120, eeg: EEG=None, save_fn=None, n_trials = 2010, iti = 0.3, soa = 0.2, jitter = 0.2, secs=0.2, volume=0.8, random_state=42, s1_freq="C", s2_freq="D", s1_octave=5, s2_octave=6):
def __init__(self, duration=120, eeg: Optional[EEG]=None, save_fn=None, n_trials = 2010, iti = 0.3, soa = 0.2, jitter = 0.2, secs=0.2, volume=0.8, random_state=42, s1_freq="C", s2_freq="D", s1_octave=5, s2_octave=6):
"""
Auditory Oddball Experiment
Expand Down
4 changes: 3 additions & 1 deletion eegnb/experiments/auditory_oddball/auditory_erp_arrayin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

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

#from eegnb.stimuli import FACE_HOUSE


def present(eeg: EEG=None, save_fn=None,
def present(eeg: Optional[EEG]=None, save_fn=None,
stim_types=None, itis=None, additional_labels={},
secs=0.07, volume=0.8,tone1_hz =440, tone2_hz = 528,
do_fixation=True):
Expand Down
4 changes: 2 additions & 2 deletions eegnb/experiments/visual_codeprose/codeprose.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# TODO: Switch to using time_ns when Python 3.7 is the minimum version for eegnb
from time import time, strftime, gmtime
from typing import List
from typing import Optional, List
from pathlib import Path
from dataclasses import dataclass, field
from ...devices.eeg import EEG
Expand Down Expand Up @@ -167,7 +167,7 @@ def run(window: visual.Window) -> pd.DataFrame:
return pd.DataFrame(responses)


def fixate(window: visual.Window, text: str = None):
def fixate(window: visual.Window, text: Optional[str] = None):
visual.TextStim(
win=window,
text=text,
Expand Down
3 changes: 2 additions & 1 deletion eegnb/experiments/visual_n170/n170.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
from eegnb.devices.eeg import EEG
from eegnb.stimuli import FACE_HOUSE
from eegnb.experiments import Experiment
from typing import Optional


class VisualN170(Experiment.BaseExperiment):

def __init__(self, duration=120, eeg: EEG=None, save_fn=None,
def __init__(self, duration=120, eeg: Optional[EEG]=None, save_fn=None,
n_trials = 2010, iti = 0.4, soa = 0.3, jitter = 0.2):

# Set experiment name
Expand Down
3 changes: 2 additions & 1 deletion eegnb/experiments/visual_p300/p300.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
from eegnb.stimuli import CAT_DOG
from eegnb.experiments import Experiment
from eegnb.devices.eeg import EEG
from typing import Optional

class VisualP300(Experiment.BaseExperiment):

def __init__(self, duration=120, eeg: EEG=None, save_fn=None,
def __init__(self, duration=120, eeg: Optional[EEG]=None, save_fn=None,
n_trials = 2010, iti = 0.4, soa = 0.3, jitter = 0.2):

exp_name = "Visual P300"
Expand Down
3 changes: 2 additions & 1 deletion eegnb/experiments/visual_ssvep/ssvep.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@

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


class VisualSSVEP(Experiment.BaseExperiment):

def __init__(self, duration=120, eeg: EEG=None, save_fn=None, n_trials = 2010, iti = 0.5, soa = 3.0, jitter = 0.2):
def __init__(self, duration=120, eeg: Optional[EEG]=None, save_fn=None, n_trials = 2010, iti = 0.5, soa = 3.0, jitter = 0.2):

exp_name = "Visual SSVEP"
super().__init__(exp_name, duration, eeg, save_fn, n_trials, iti, soa, jitter)
Expand Down
3 changes: 2 additions & 1 deletion eegnb/experiments/visual_vep/vep.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from time import time, strftime, gmtime
from pylsl import StreamInfo, StreamOutlet
from eegnb.experiments.Experiment import Experiment
from typing import Optional


class VisualVEP(Experiment):

def __init__(self, duration=120, eeg: EEG=None, save_fn=None,
def __init__(self, duration=120, eeg: Optional[EEG]=None, save_fn=None,
n_trials = 2000, iti = 0.2, soa = 0.2, jitter = 0.1):

exp_name = "Visual VEP"
Expand Down

0 comments on commit adf5e28

Please sign in to comment.