-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
33,999 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
"""Unittests for tdm_loader""" | ||
import os | ||
from distutils import dir_util | ||
import pytest | ||
import numpy as np | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"""Tests zip based tdm files to work with tdm_loader""" | ||
import os | ||
import pytest | ||
import numpy as np | ||
from numpy.testing import assert_array_equal | ||
|
||
import tdm_loader as tdm | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def get_file_dir(request): | ||
"""Fixture for loading the supplementary test files directory""" | ||
filename = request.module.__file__ | ||
test_dir, _ = os.path.splitext(filename) | ||
return test_dir | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def tdm_file(get_file_dir): | ||
"""Fixture for loading a test tdm file""" | ||
path = f"{get_file_dir}/2021-02-26_07-55-01.TDM" | ||
data = tdm.OpenFile(str(path)) | ||
return data | ||
|
||
|
||
def test_explicit_sequence_representation(get_file_dir, tdm_file): | ||
"""Handles explicit sequence representation channels correctly""" | ||
print(f"{get_file_dir}/channel15.txt") | ||
assert_array_equal( | ||
tdm_file.channel(1, 5), np.loadtxt(f"{get_file_dir}/channel15.txt") | ||
) | ||
assert tdm_file.channel_name(1, 5) == "eps_HAC_RE_CIT_UN_c_Offset" | ||
|
||
|
||
def test_linear_implicit_repr(get_file_dir, tdm_file): | ||
"""Handles linear_implicit sequence representation correctly""" | ||
assert_array_equal( | ||
tdm_file.channel(0, 1), np.loadtxt(f"{get_file_dir}/channel01.txt") | ||
) | ||
assert tdm_file.channel_name(0, 1) == "Zeit_[200Hz]-abs" | ||
assert tdm_file.channel(0, 1).shape == (11316,) | ||
|
||
|
||
def test_raw_linear_repr(get_file_dir, tdm_file): | ||
"""Handles linear_implicit sequence representation correctly""" | ||
assert tdm_file.channel_name(0, 15) == "F___Zylinder_02" | ||
assert_array_equal( | ||
tdm_file.channel(0, 15), np.loadtxt(f"{get_file_dir}/channel015.txt") | ||
) |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.