Skip to content

Commit

Permalink
Merge pull request #386 from monicayao/pr376/statsv2
Browse files Browse the repository at this point in the history
[TST] Additional smoke tests for stats.py
  • Loading branch information
emdupre authored Sep 6, 2019
2 parents 87e5d58 + 8392fd4 commit 5a8707d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tedana/tests/test_stats_computefeats2.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,21 @@ def test_break_computefeats2():
assert str(e_info.value) == ('Second dimensions (number of volumes) of data ({0}) '
'and mmix ({1}) do not match.'.format(data.shape[0],
mmix.shape[0]))


# SMOKE TEST

def test_smoke_computefeats2():
"""
Ensures that computefeats2 works with random inputs and different optional parameters
"""
n_samples, n_times, n_components = 100, 20, 6
data = np.random.random((n_samples, n_times))
mmix = np.random.random((n_times, n_components))
mask = np.random.randint(2, size=n_samples)

assert computefeats2(data, mmix) is not None
assert computefeats2(data, mmix, mask=mask) is not None
assert computefeats2(data, mmix, normalize=False) is not None


18 changes: 18 additions & 0 deletions tedana/tests/test_stats_get_coeffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,21 @@ def test_break_get_coeffs():
get_coeffs(data, X, mask, add_const=False)
assert str(e_info.value) == ('First dimensions of data ({0}) and mask ({1}) do not '
'match'.format(data.shape[0], mask.shape[0]))



# SMOKE TEST
def test_smoke_get_coeffs():
"""
Ensure that get_coeffs returns outputs with different inputs and optional paramters
"""
n_samples, n_echos, n_times, n_components = 100, 5, 20, 6
data_2d = np.random.random((n_samples, n_times))
#data_3d = np.random.random((n_samples, n_echos, n_times))
x = np.random.random((n_times, n_components))
mask = np.random.randint(2, size=n_samples)

assert get_coeffs(data_2d, x) is not None
# assert get_coeffs(data_3d, x) is not None TODO: submit an issue for the bug
assert get_coeffs(data_2d, x, mask=mask) is not None
assert get_coeffs(data_2d, x, add_const=True) is not None
15 changes: 15 additions & 0 deletions tedana/tests/test_stats_getfbounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np
import pytest
import random

from tedana.stats import getfbounds

Expand All @@ -13,3 +14,17 @@ def test_getfbounds():

for n_echos in good_inputs:
getfbounds(n_echos)


# SMOKE TEST

def test_smoke_getfbounds():
"""
Ensures that getfbounds returns outputs when fed in a random number of echos
"""
n_echos = random.randint(3, 10) # At least two echos!
f05, f025, f01 = getfbounds(n_echos)

assert f05 is not None
assert f025 is not None
assert f01 is not None

0 comments on commit 5a8707d

Please sign in to comment.