Skip to content

Commit

Permalink
Get CI test builds working again! (#170)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
ErikBjare and oreHGA authored Apr 27, 2023
1 parent 81dd244 commit 7be54d6
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 364 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ jobs:
python-version: 3.8
- name: Install dependencies
run: |
make install-deps-apt
python -m pip install --upgrade pip wheel
python -m pip install attrdict
# 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-22.04 wxPython
make install-deps-wxpython
- name: Build project
run: |
make build
pip install .
- name: Build docs
run: |
cd doc && make html
make docs
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master' # TODO: Deploy seperate develop-version of docs?
Expand Down
57 changes: 18 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
name: ${{ matrix.os }}, py-${{ matrix.python_version }}
name: test (${{ matrix.os }}, py-${{ matrix.python_version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -44,29 +44,17 @@ jobs:
- name: Install APT dependencies
if: "startsWith(runner.os, 'Linux')"
run: |
# update archive links
sudo apt-get update
# xvfb is a dependency to create a virtual display
# libgtk-3-dev is a requirement for wxPython
# freeglut3-dev is a requirement for a wxPython dependency
sudo apt-get -y install xvfb libgtk-3-dev freeglut3-dev
make install-deps-apt
- name: Upgrade pip
run: |
python -m pip install --upgrade pip wheel
- name: Install Linux dependencies
if: "startsWith(runner.os, 'Linux')"
run: |
python -m pip install --upgrade pip wheel
# 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-22.04 wxPython
pip install .
- name: Install MacOS/Windows dependencies
make install-deps-wxpython
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install .
pip install -U psychtoolbox # JG_ADD
# EB: needed?
make build
- name: Run eegnb install test
shell: bash
run: |
Expand All @@ -83,9 +71,10 @@ jobs:
Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &> xvfb.log &
export DISPLAY=:0
fi
pytest
make test
typecheck:
name: typecheck (${{ matrix.os }}, py-${{ matrix.python_version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -102,27 +91,17 @@ jobs:
- name: Install APT dependencies
if: "startsWith(runner.os, 'Linux')"
run: |
# update archive links
sudo apt-get update
# xvfb is a dependency to create a virtual display
# libgtk-3-dev is a requirement for wxPython
# freeglut3-dev is a requirement for a wxPython dependency
sudo apt-get -y install xvfb libgtk-3-dev freeglut3-dev
make install-deps-apt
- name: Upgrade pip
run: |
python -m pip install --upgrade pip wheel
- name: Install Linux dependencies
if: "startsWith(runner.os, 'Linux')"
run: |
python -m pip install --upgrade pip wheel
# 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-22.04 wxPython
pip install .
- name: Install MacOS/Windows dependencies
make install-deps-wxpython
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install .
make build
- name: Typecheck
run: |
# Exclude visual_cueing due to errors
python -m mypy --exclude 'examples/visual_cueing'
make typecheck
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
build:
pip install .

test:
pytest

typecheck:
# Exclude visual_cueing due to errors
python -m mypy --exclude 'examples/visual_cueing'

docs:
cd doc && make html

clean:
cd doc && make clean

install-deps-apt:
sudo apt-get update # update archive links

# xvfb is a dependency to create a virtual display
# libgtk-3-dev is a requirement for wxPython
# freeglut3-dev is a requirement for a wxPython dependency
# portaudio19-dev *might* be required to import psychopy on Ubuntu
# pulseaudio *might* be required to actually run the tests (on PsychoPy import)
# libpulse-dev required to build pocketsphinx (speech recognition dependency of psychopy)
# libsdl2-dev required by psychopy
# libnotify4 is so we can have the libnotify.so module used in wxPython working
sudo apt-get -y install xvfb libgtk-3-dev freeglut3-dev portaudio19-dev libpulse-dev pulseaudio libsdl2-dev libnotify4

# configure dynamic links
sudo ldconfig

UPDATED_LIBPATH=$(sudo find / -name libnotify.so)
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$UPDATED_LIBPATH

install-deps-wxpython:
# 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-22.04 wxPython
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def setup(app):
'backreferences_dir': 'generated', # Where to drop linking files between examples & API
'doc_module': ('eeg-notebooks',),
'reference_url': {'eeg-notebooksS': None},
'remove_conffig_comments': True,
'remove_config_comments': True,
}
"""
12 changes: 7 additions & 5 deletions eegnb/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from copy import deepcopy
import math
import logging
import sys
from collections import OrderedDict
from glob import glob
from typing import Union, List#, Dict
Expand All @@ -20,6 +21,7 @@
from mne.channels import make_standard_montage
from mne.filter import create_filter
from matplotlib import pyplot as plt
from scipy import stats
from scipy.signal import lfilter, lfilter_zi

from eegnb import _get_recording_dir
Expand Down Expand Up @@ -221,7 +223,8 @@ def plot_conditions(
ylim=(-6, 6),
diff_waveform=(1, 2),
channel_count=4,
channel_order=None):
channel_order=None,
):
"""Plot ERP conditions.
Args:
epochs (mne.epochs): EEG epochs
Expand All @@ -247,10 +250,9 @@ def plot_conditions(
"""

if channel_order:
channel_order = np.array(channel_order)
channel_order = np.array(channel_order)
else:
channel_order = np.array(range(channel_count))

channel_order = np.array(range(channel_count))

if isinstance(conditions, dict):
conditions = OrderedDict(conditions)
Expand All @@ -260,7 +262,7 @@ def plot_conditions(

X = epochs.get_data() * 1e6

X = X[:,channel_order]
X = X[:, channel_order]

times = epochs.times
y = pd.Series(epochs.events[:, -1])
Expand Down
Loading

0 comments on commit 7be54d6

Please sign in to comment.