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

[TST] Additional smoke tests for stats.py #386

Merged
merged 7 commits into from
Sep 6, 2019
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
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