Skip to content

Commit

Permalink
tests: add standard test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Aug 9, 2021
1 parent 4fff4fb commit d652e50
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyjibe/fd/tab_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ def set_preprocessing(self, preprocessing, options=None):
opts = options[pid]
key = sorted(opts.keys())[0] # not future-proof
idx = pwidget.comboBox.findData(opts[key])
pwidget.setCurrentIndex(idx)
pwidget.comboBox.setCurrentIndex(idx)
24 changes: 24 additions & 0 deletions tests/test_fd_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test of data set functionalities"""
import numpy as np
import pytest

import pyjibe.head

Expand Down Expand Up @@ -56,3 +57,26 @@ def test_fit_all(qtbot):
a1 = war.data_set[0]
a2 = war.data_set[1]
assert a1.fit_properties == a2.fit_properties


@pytest.mark.parametrize("method,contact_point", [
["scheme_2020", 1805],
["gradient_zero_crossing", 1902],
["fit_constant_line", 1838],
["deviation_from_baseline", 1805],
])
def test_preprocessing_poc_estimation(method, contact_point):
main_window = pyjibe.head.PyJibe()
main_window.load_data(files=make_directory_with_data(2))
war = main_window.subwindows[0].widget()
# clear data
war.cb_autosave.setChecked(0)
war.tabs.setCurrentIndex(0)
# perform simple filter
war.tab_preprocess.set_preprocessing(
preprocessing=["compute_tip_position", "correct_tip_offset"],
options={"correct_tip_offset": {"method": method}}
)
war.tabs.setCurrentIndex(1)
fd = war.data_set[0]
assert np.argmin(np.abs(fd["tip position"])) == contact_point

0 comments on commit d652e50

Please sign in to comment.