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

ci: update Python to 3.8, update wxPython #222

Merged
merged 6 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand All @@ -22,7 +22,7 @@ jobs:

# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
# See: https://wxpython.org/pages/downloads/index.html
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython

pip install .
- name: Build docs
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,34 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python_version: [3.7]
os: ['ubuntu-22.04', windows-latest, macOS-latest]
python_version: ['3.8']
include:
- os: ubuntu-latest
python_version: 3.8
# Experimental: Python 3.9
# Works fine, commented out because mostly covered (at least installing/building deps) by the typecheck job
# See issue: https://github.com/NeuroTechX/eeg-notebooks/issues/50
#- os: ubuntu-latest
# python_version: 3.9

# Check 3.10 for future-proofing
- os: ubuntu-22.04
python_version: '3.10'

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

# Not needed if pywinhook is installed from wheels
#- name: Install swig
# if: "startsWith(runner.os, 'windows')"
# run: |
# (New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.0.1.zip","swigwin-4.0.1.zip");
# Expand-Archive .\swigwin-4.0.1.zip .;
# echo "$((Get-Item .).FullName)/swigwin-4.0.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Install APT dependencies
if: "startsWith(runner.os, 'Linux')"
run: |
Expand All @@ -53,9 +57,10 @@ jobs:

# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
# See: https://wxpython.org/pages/downloads/index.html
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython

pip install .

- name: Install MacOS/Windows dependencies
run: |
python -m pip install --upgrade pip wheel
Expand Down Expand Up @@ -85,7 +90,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: ['ubuntu-22.04']
python_version: [3.9]

steps:
Expand All @@ -110,7 +115,7 @@ jobs:

# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
# See: https://wxpython.org/pages/downloads/index.html
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython

pip install .
- name: Install MacOS/Windows dependencies
Expand Down
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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Main repo requirements
psychopy==2022.2.4
psychopy==2023.1.0
psychtoolbox
scikit-learn>=0.23.2
pandas>=1.1.4
numpy>=1.19.4
numpy>=1.19.4,<1.24 # due to outdated libs not changing the names after: https://github.com/numpy/numpy/pull/22607
mne>=0.20.8
seaborn>=0.9.0
pyriemann>=0.2.7
Expand Down