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

Allow utils._subsampling to accept ndarray #20

Merged
merged 3 commits into from
Feb 19, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add comments; visually space out subsampling tests
  • Loading branch information
notZaki committed Jan 7, 2021
commit 3085eb048cb4fa5c0308dfef0e68d734aa6ed9b6
3 changes: 3 additions & 0 deletions mapca/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,17 @@ def test_subsampling():
"""
Unit test for subsampling function
"""
# 1D input
test_data = np.array([1])
sub_data = _subsampling(test_data, sub_depth=2)
assert sub_data.shape == (1,)
assert np.all(sub_data == test_data[::2])
# 2D input
test_data = np.random.rand(6, 9)
sub_data = _subsampling(test_data, sub_depth=3)
assert sub_data.shape == (2, 3)
assert np.all(sub_data == test_data[::3, ::3])
# 3D input
test_data = np.random.rand(2, 3, 4)
sub_data = _subsampling(test_data, sub_depth=2)
assert sub_data.shape == (1, 2, 2)
Expand Down