Skip to content

Commit 37b1a79

Browse files
committed
[REL] 0.3.0
1 parent 77ac9e4 commit 37b1a79

File tree

8 files changed

+61
-53
lines changed

8 files changed

+61
-53
lines changed

.codecov.yml

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

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ Follow this workflow:
136136
1. go to your python environment for `pyprep`
137137
1. make sure all tests pass and the docs are built cleanly
138138
1. update `docs/whats_new.rst`, renaming the "current" headline to the new
139-
version and adding all "Authors" for the release. "Authors" are all people
140-
who committed code or in other ways contributed to `pyprep` for this release
141-
(e.g., by reviewing PRs).
139+
version and updating the "Authors" section. "Authors" are all people
140+
who committed code or in other ways contributed to `pyprep` (e.g., by
141+
reviewing PRs, moderating discussions).
142142
1. commit the change and `git push` to master (or make a pull request).
143143
Start your commit message with `[REL]`.
144144
1. make an annotated tag `git tag -a -m "1.2.3" 1.2.3 upstream/master` (This

.github/workflows/python_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
3838
- name: Test with pytest
3939
run: |
40-
pytest tests/ --cov=pyprep/ --cov-report=xml --verbose
40+
pytest tests/ --cov=pyprep/ --cov-report=xml --cov-config=setup.cfg --verbose
4141
4242
- name: Build docs
4343
run: |

docs/whats_new.rst

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@ Here we list a changelog of pyprep.
1313

1414
.. currentmodule:: pyprep
1515

16-
.. _current:
17-
18-
Current
16+
Authors
1917
-------
18+
People who contributed to this software across releases (in alphabetical order)
19+
20+
* `Aamna Lawrence`_
21+
* `Adam Li`_
22+
* `Stefan Appelhoff`_
23+
* `Victor Xiang`_
24+
* `Yorguin Mantilla`_
25+
26+
.. _changes_0_3_0:
27+
28+
Version 0.3.0
29+
-------------
2030

2131
Changelog
2232
~~~~~~~~~
@@ -71,17 +81,6 @@ Changelog
7181

7282
- Add :func:`find_bad_epochs` based on the FASTER algorithm, by `Stefan Appelhoff`_ (`0fa9c06 <https://github.com/sappelhoff/pyprep/commit/0fa9c065481c4cbaaf83b275f92b16b8807810b5>`_)
7383

74-
75-
Authors
76-
-------
77-
People who contributed to this software (in alphabetical order)
78-
79-
* Stefan Appelhoff
80-
* Aamna Lawrence
81-
* Adam Li
82-
* Yorguin Mantilla
83-
* Victor Xiang
84-
8584
.. _Stefan Appelhoff: http://stefanappelhoff.com/
8685
.. _Aamna Lawrence: https://github.com/AamnaLawrence
8786
.. _Adam Li: https://github.com/adam2392/

setup.cfg

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ license = MIT
1212
license_files = LICENSE
1313
platforms = any
1414
classifiers =
15-
Topic :: Scientific/Engineering,
16-
Programming Language :: Python :: 3,
17-
Intended Audience :: Science/Research,
18-
Development Status :: 3 - Alpha,
15+
Topic :: Scientific/Engineering
16+
Programming Language :: Python :: 3
17+
Intended Audience :: Science/Research
18+
Development Status :: 3 - Alpha
1919
License :: OSI Approved :: MIT License
2020
Operating System :: POSIX :: Linux
2121
Operating System :: Unix
@@ -59,11 +59,28 @@ docstring-convention = numpy
5959
max-line-length = 88
6060
extend-ignore =
6161
# See https://github.com/PyCQA/pycodestyle/issues/373
62-
E203,
62+
E203
6363
exclude =
64-
versioneer.py,
65-
_version.py,
64+
versioneer.py
65+
_version.py
6666
*docs/_build/*
6767
*docs/auto_examples/*
6868
*build/lib*
6969
examples/
70+
71+
[coverage:run]
72+
omit =
73+
# Do not include test script in coverage report
74+
*tests*
75+
setup.py
76+
pyprep/_version.py
77+
78+
[coverage:report]
79+
# Regexes for lines to exclude from consideration
80+
exclude_lines =
81+
# Have to re-enable the standard pragma
82+
pragma: no cover
83+
84+
# Don't complain if non-runnable code isn't run:
85+
if 0:
86+
if __name__ == .__main__.:

tests/conftest.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,8 @@ def raw():
2121

2222
# using sample EEG data (https://physionet.org/content/eegmmidb/1.0.0/)
2323
raw = mne.io.read_raw_edf(edf_fpath, preload=True)
24-
raw.rename_channels(lambda s: s.strip("."))
25-
raw.rename_channels(
26-
lambda s: s.replace("c", "C")
27-
.replace("o", "O")
28-
.replace("f", "F")
29-
.replace("t", "T")
30-
.replace("Tp", "TP")
31-
.replace("Cp", "CP")
32-
)
24+
25+
# The eegbci data has non-standard channel names. We need to rename them:
26+
eegbci.standardize(raw)
27+
3328
return raw

tests/test_noisy.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from pyprep.noisy import Noisydata, find_bad_epochs
88

9+
RNG = np.random.RandomState(1337)
10+
911

1012
def make_random_mne_object(
1113
sfreq=1000.0, t_secs=600, n_freq_comps=5, freq_range=[10, 60]
@@ -65,7 +67,7 @@ def make_random_mne_object(
6567
for chan in range(n_chans):
6668
# Each channel signal is a sum of random freq sine waves
6769
for freq_i in range(n_freq_comps):
68-
freq = np.random.randint(low, high, signal_len)
70+
freq = RNG.randint(low, high, signal_len)
6971
signal[chan, :] += np.sin(2 * np.pi * t * freq)
7072

7173
signal *= 1e-6 # scale to Volts
@@ -89,7 +91,7 @@ def make_random_mne_object(
8991
# Make some arbitrary events sampled from the mid-section of raw.times
9092
n_events = 3
9193
ival_secs = [0.2, 0.8]
92-
marker_samples = np.random.choice(raw.times[5:-5], size=n_events, replace=False)
94+
marker_samples = RNG.choice(raw.times[5:-5], size=n_events, replace=False)
9395
events = np.asarray(
9496
[marker_samples, np.zeros(n_events), np.ones(n_events)], dtype="int64"
9597
)
@@ -106,9 +108,7 @@ def test_find_bad_epochs(epochs=epochs):
106108
assert bads == []
107109

108110

109-
@pytest.mark.parametrize(
110-
"input", [raw, {"key": 1}, [1, 2, 3], np.random.random((3, 3))]
111-
)
111+
@pytest.mark.parametrize("input", [raw, {"key": 1}, [1, 2, 3], RNG.random((3, 3))])
112112
def test_init(input):
113113
"""Test the class initialization."""
114114
# Initialize with an mne object should work
@@ -138,7 +138,7 @@ def test_find_bad_by_nan(raw=raw):
138138
m, n = raw_tmp._data.shape
139139

140140
# Insert a nan value for a random channel
141-
rand_chn_idx = int(np.random.randint(0, m, 1))
141+
rand_chn_idx = int(RNG.randint(0, m, 1))
142142
rand_chn_lab = raw_tmp.ch_names[rand_chn_idx]
143143
raw_tmp._data[rand_chn_idx, n - 1] = np.nan
144144

@@ -157,7 +157,7 @@ def test_find_bad_by_flat(raw=raw):
157157
raw_tmp._data *= 1e100
158158

159159
# Now insert one random flat channel
160-
rand_chn_idx = int(np.random.randint(0, m, 1))
160+
rand_chn_idx = int(RNG.randint(0, m, 1))
161161
rand_chn_lab = raw_tmp.ch_names[rand_chn_idx]
162162
raw_tmp._data[rand_chn_idx, :] = np.ones_like(raw_tmp._data[1, :])
163163

@@ -169,13 +169,13 @@ def test_find_bad_by_flat(raw=raw):
169169

170170
def test_find_bad_by_deviation(raw=raw):
171171
"""Test find_bad_by_deviation."""
172-
np.random.seed(12345)
172+
RNG.seed(12345)
173173

174174
raw_tmp = raw.copy()
175175
m, n = raw_tmp._data.shape
176176

177177
# Now insert one random channel with very low deviations
178-
rand_chn_idx = int(np.random.randint(0, m, 1))
178+
rand_chn_idx = int(RNG.randint(0, m, 1))
179179
rand_chn_lab = raw_tmp.ch_names[rand_chn_idx]
180180
raw_tmp._data[rand_chn_idx, :] = np.ones_like(raw_tmp._data[1, :])
181181

@@ -186,7 +186,7 @@ def test_find_bad_by_deviation(raw=raw):
186186

187187
# Insert a channel with very high deviation
188188
raw_tmp = raw.copy()
189-
rand_chn_idx = int(np.random.randint(0, m, 1))
189+
rand_chn_idx = int(RNG.randint(0, m, 1))
190190
rand_chn_lab = raw_tmp.ch_names[rand_chn_idx]
191191
arbitrary_scaling = 5
192192
raw_tmp._data[rand_chn_idx, :] *= arbitrary_scaling
@@ -206,15 +206,15 @@ def test_find_bad_by_correlation(
206206

207207
# The test data is correlated well
208208
# We insert a badly correlated channel and see if it is detected.
209-
rand_chn_idx = int(np.random.randint(0, m, 1))
209+
rand_chn_idx = int(RNG.randint(0, m, 1))
210210
rand_chn_lab = raw_tmp.ch_names[rand_chn_idx]
211211

212212
# Use cosine instead of sine to create a signal
213213
low = freq_range[0]
214214
high = freq_range[1]
215215
signal = np.zeros((1, n))
216216
for freq_i in range(n_freq_comps):
217-
freq = np.random.randint(low, high, n)
217+
freq = RNG.randint(low, high, n)
218218
signal[0, :] += np.cos(2 * np.pi * raw.times * freq)
219219

220220
raw_tmp._data[rand_chn_idx, :] = signal * 1e-6
@@ -232,13 +232,13 @@ def test_find_bad_by_hf_noise(raw=raw, n_freq_comps=n_freq_comps):
232232

233233
# The test data has low hf noise
234234
# We insert a a chan with a lot hf noise
235-
rand_chn_idx = int(np.random.randint(0, m, 1))
235+
rand_chn_idx = int(RNG.randint(0, m, 1))
236236
rand_chn_lab = raw_tmp.ch_names[rand_chn_idx]
237237

238238
# Use freqs between 90 and 100 Hz to insert hf noise
239239
signal = np.zeros((1, n))
240240
for freq_i in range(n_freq_comps):
241-
freq = np.random.randint(90, 100, n)
241+
freq = RNG.randint(90, 100, n)
242242
signal[0, :] += np.sin(2 * np.pi * raw.times * freq)
243243

244244
raw_tmp._data[rand_chn_idx, :] = signal * 1e-6
@@ -261,7 +261,7 @@ def test_find_bad_by_ransac(raw=raw):
261261

262262
def test_ransac_too_few_preds(raw=raw):
263263
"""Test that ransac throws an error for few predictors."""
264-
chns = np.random.choice(raw.ch_names, size=3, replace=False)
264+
chns = RNG.choice(raw.ch_names, size=3, replace=False)
265265
raw_tmp = raw.copy()
266266
raw_tmp.pick_channels(chns)
267267
nd = Noisydata(raw_tmp)

tests/test_prep_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_prep_pipeline(raw, montage):
2121
"reref_chs": ch_names_eeg,
2222
"line_freqs": np.arange(60, sample_rate / 2, 60),
2323
}
24-
prep = PrepPipeline(raw_copy, prep_params, montage)
24+
prep = PrepPipeline(raw_copy, prep_params, montage, random_state=42)
2525
prep.fit()
2626

2727
EEG_raw = raw_copy.get_data(picks="eeg") * 1e6

0 commit comments

Comments
 (0)