Skip to content

Commit 2d74871

Browse files
authored
Revert PR #167: "ci: fix broken CI" (#169)
1 parent d358d5e commit 2d74871

10 files changed

Lines changed: 391 additions & 133 deletions

File tree

.github/workflows/docs.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-18.04
1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: Set up Python
@@ -17,14 +17,16 @@ jobs:
1717
python-version: 3.8
1818
- name: Install dependencies
1919
run: |
20-
make install-deps-apt
2120
python -m pip install --upgrade pip wheel
2221
23-
make install-deps-wxpython
22+
# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
23+
# See: https://wxpython.org/pages/downloads/index.html
24+
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
25+
2426
pip install .
2527
- name: Build docs
2628
run: |
27-
make docs
29+
cd doc && make html
2830
- name: Deploy Docs
2931
uses: peaceiris/actions-gh-pages@v3
3032
if: github.ref == 'refs/heads/master'

.github/workflows/test.yml

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ on:
88

99
jobs:
1010
test:
11-
name: test (${{ matrix.os }}, py-${{ matrix.python_version }})
11+
name: ${{ matrix.os }}, py-${{ matrix.python_version }}
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, windows-latest, macOS-latest]
17-
python_version: [3.8]
18-
#include:
17+
python_version: [3.7]
18+
include:
19+
- os: ubuntu-latest
20+
python_version: 3.8
1921
# Experimental: Python 3.9
2022
# Works fine, commented out because mostly covered (at least installing/building deps) by the typecheck job
2123
# See issue: https://github.com/NeuroTechX/eeg-notebooks/issues/50
@@ -38,22 +40,33 @@ jobs:
3840
- name: Install APT dependencies
3941
if: "startsWith(runner.os, 'Linux')"
4042
run: |
41-
make install-deps-apt
42-
- name: Upgrade pip
43-
run: |
44-
python -m pip install --upgrade pip wheel
43+
# update archive links
44+
sudo apt-get update
45+
# xvfb is a dependency to create a virtual display
46+
# libgtk-3-dev is a requirement for wxPython
47+
# freeglut3-dev is a requirement for a wxPython dependency
48+
sudo apt-get -y install xvfb libgtk-3-dev freeglut3-dev
4549
- name: Install Linux dependencies
4650
if: "startsWith(runner.os, 'Linux')"
4751
run: |
48-
make install-deps-wxpython
49-
- name: Install dependencies
52+
python -m pip install --upgrade pip wheel
53+
54+
# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
55+
# See: https://wxpython.org/pages/downloads/index.html
56+
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
57+
58+
pip install .
59+
- name: Install MacOS/Windows dependencies
5060
run: |
51-
make build
61+
python -m pip install --upgrade pip wheel
62+
pip install .
5263
- name: Run eegnb install test
5364
shell: bash
65+
pip install -U psychtoolbox # JG_ADD
5466
run: |
5567
if [ "$RUNNER_OS" == "Linux" ]; then
5668
Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &> xvfb.log &
69+
/
5770
export DISPLAY=:0
5871
fi
5972
eegnb --help
@@ -65,10 +78,9 @@ jobs:
6578
Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &> xvfb.log &
6679
export DISPLAY=:0
6780
fi
68-
make test
81+
pytest
6982
7083
typecheck:
71-
name: typecheck (${{ matrix.os }}, py-${{ matrix.python_version }})
7284
runs-on: ${{ matrix.os }}
7385
strategy:
7486
fail-fast: false
@@ -85,17 +97,27 @@ jobs:
8597
- name: Install APT dependencies
8698
if: "startsWith(runner.os, 'Linux')"
8799
run: |
88-
make install-deps-apt
89-
- name: Upgrade pip
90-
run: |
91-
python -m pip install --upgrade pip wheel
100+
# update archive links
101+
sudo apt-get update
102+
# xvfb is a dependency to create a virtual display
103+
# libgtk-3-dev is a requirement for wxPython
104+
# freeglut3-dev is a requirement for a wxPython dependency
105+
sudo apt-get -y install xvfb libgtk-3-dev freeglut3-dev
92106
- name: Install Linux dependencies
93107
if: "startsWith(runner.os, 'Linux')"
94108
run: |
95-
make install-deps-wxpython
96-
- name: Install dependencies
109+
python -m pip install --upgrade pip wheel
110+
111+
# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
112+
# See: https://wxpython.org/pages/downloads/index.html
113+
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
114+
115+
pip install .
116+
- name: Install MacOS/Windows dependencies
97117
run: |
98-
make build
118+
python -m pip install --upgrade pip wheel
119+
pip install .
99120
- name: Typecheck
100121
run: |
101-
make typecheck
122+
# Exclude visual_cueing due to errors
123+
python -m mypy --exclude 'examples/visual_cueing'

Makefile

Lines changed: 0 additions & 32 deletions
This file was deleted.

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def setup(app):
263263
'backreferences_dir': 'generated', # Where to drop linking files between examples & API
264264
'doc_module': ('eeg-notebooks'),
265265
'reference_url': {'eeg-notebooks': None},
266-
'remove_config_comments': True}
266+
'remove_conffig_comments': True}
267267

268268
"""
269269
sphinx_gallery_conf = {
@@ -284,7 +284,7 @@ def setup(app):
284284
'backreferences_dir': 'generated', # Where to drop linking files between examples & API
285285
'doc_module': ('eeg-notebooks',),
286286
'reference_url': {'eeg-notebooksS': None},
287-
'remove_config_comments': True,
287+
'remove_conffig_comments': True,
288288
}
289289
290290
"""

eegnb/analysis/utils.py

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
from copy import deepcopy
33
import math
44
import logging
5-
import sys
65
from collections import OrderedDict
76
from glob import glob
8-
from typing import Union, List
7+
from typing import Union, List, Dict
98
from time import sleep, time
9+
from numpy.core.fromnumeric import std
1010

1111
import pandas as pd
1212
import numpy as np
@@ -16,13 +16,13 @@
1616
from mne.channels import make_standard_montage
1717
from mne.filter import create_filter
1818
from matplotlib import pyplot as plt
19-
from scipy import stats
2019
from scipy.signal import lfilter, lfilter_zi
2120

2221
from eegnb import _get_recording_dir
2322
from eegnb.devices.eeg import EEG
2423
from eegnb.devices.utils import EEG_INDICES, SAMPLE_FREQS
2524

25+
2626

2727
# this should probably not be done here
2828
sns.set_context("talk")
@@ -32,33 +32,6 @@
3232
logger = logging.getLogger(__name__)
3333

3434

35-
def _bootstrap(data, n_boot: int, ci: float):
36-
"""From: https://stackoverflow.com/a/47582329/965332"""
37-
boot_dist = []
38-
for i in range(int(n_boot)):
39-
resampler = np.random.randint(0, data.shape[0], data.shape[0])
40-
sample = data.take(resampler, axis=0)
41-
boot_dist.append(np.mean(sample, axis=0))
42-
b = np.array(boot_dist)
43-
s1 = np.apply_along_axis(stats.scoreatpercentile, 0, b, 50 - ci / 2)
44-
s2 = np.apply_along_axis(stats.scoreatpercentile, 0, b, 50 + ci / 2)
45-
return (s1, s2)
46-
47-
48-
def _tsplotboot(ax, data, time: list, n_boot: int, ci: float, color):
49-
"""From: https://stackoverflow.com/a/47582329/965332"""
50-
# Time forms the xaxis of the plot
51-
if time is None:
52-
x = np.arange(data.shape[1])
53-
else:
54-
x = np.asarray(time)
55-
est = np.mean(data, axis=0)
56-
cis = _bootstrap(data, n_boot, ci)
57-
ax.fill_between(x, cis[0], cis[1], alpha=0.2, color=color)
58-
ax.plot(x, est, color=color)
59-
ax.margins(x=0)
60-
61-
6235
def load_csv_as_raw(
6336
fnames: List[str],
6437
sfreq: float,
@@ -179,9 +152,7 @@ def load_data(
179152
site = "*"
180153

181154
data_path = (
182-
_get_recording_dir(
183-
device_name, experiment, subject_str, session_str, site, data_dir
184-
)
155+
_get_recording_dir(device_name, experiment, subject_str, session_str, site, data_dir)
185156
/ "*.csv"
186157
)
187158
fnames = glob(str(data_path))
@@ -222,8 +193,7 @@ def plot_conditions(
222193
ylim=(-6, 6),
223194
diff_waveform=(1, 2),
224195
channel_count=4,
225-
channel_order=None,
226-
):
196+
channel_order=None):
227197
"""Plot ERP conditions.
228198
Args:
229199
epochs (mne.epochs): EEG epochs
@@ -249,9 +219,10 @@ def plot_conditions(
249219
"""
250220

251221
if channel_order:
252-
channel_order = np.array(channel_order)
222+
channel_order = np.array(channel_order)
253223
else:
254-
channel_order = np.array(range(channel_count))
224+
channel_order = np.array(range(channel_count))
225+
255226

256227
if isinstance(conditions, dict):
257228
conditions = OrderedDict(conditions)
@@ -261,7 +232,7 @@ def plot_conditions(
261232

262233
X = epochs.get_data() * 1e6
263234

264-
X = X[:, channel_order]
235+
X = X[:,channel_order]
265236

266237
times = epochs.times
267238
y = pd.Series(epochs.events[:, -1])
@@ -278,15 +249,13 @@ def plot_conditions(
278249

279250
for ch in range(channel_count):
280251
for cond, color in zip(conditions.values(), palette):
281-
y_cond = y.isin(cond)
282-
X_cond = X[y_cond, ch]
283-
_tsplotboot(
284-
ax=axes[ch],
285-
data=X_cond,
252+
sns.tsplot(
253+
X[y.isin(cond), ch],
286254
time=times,
287255
color=color,
288256
n_boot=n_boot,
289257
ci=ci,
258+
ax=axes[ch],
290259
)
291260

292261
if diff_waveform:

0 commit comments

Comments
 (0)