Skip to content

Commit

Permalink
Torture tests for phase unwrap (and small fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Aug 20, 2024
1 parent ff629f1 commit 802b03a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
15 changes: 11 additions & 4 deletions orangecontrib/snom/preprocess/phase_unwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
import Orange.data
from Orange.preprocess.preprocess import Preprocess

from orangecontrib.spectroscopy.preprocess.utils import SelectColumn, CommonDomain
from orangecontrib.spectroscopy.preprocess.utils import (
SelectColumn,
CommonDomainOrderUnknowns,
)


class _PhaseUnwrapCommon(CommonDomain):
def transformed(self, data):
return np.unwrap(data.X)
class _PhaseUnwrapCommon(CommonDomainOrderUnknowns):
# A possible optimization in the future:
# the "order" functionality of CommonDomainOrderUnknowns is not needed,
# but does not break anything either

def transformed(self, X, _): # noqa: N803
return np.unwrap(X)


class PhaseUnwrap(Preprocess):
Expand Down
10 changes: 9 additions & 1 deletion orangecontrib/snom/tests/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@

from Orange.data import Table

from orangecontrib.spectroscopy.tests.test_preprocess import (
TestCommonIndpSamplesMixin,
SMALLER_COLLAGEN,
)

from orangecontrib.snom.preprocess import PhaseUnwrap


class TestPhaseUnwrap(unittest.TestCase):
class TestPhaseUnwrap(unittest.TestCase, TestCommonIndpSamplesMixin):
preprocessors = [PhaseUnwrap()]
data = SMALLER_COLLAGEN

def test_simple(self):
data = Table.from_numpy(None, [[1, 1 + 2 * np.pi]])
f = PhaseUnwrap()
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ setup_requires =
setuptools-scm
install_requires =
Orange3>=3.34.0
orange-spectroscopy>=0.6.11
orange-spectroscopy>=0.6.16
numpy>=1.21.0,<2.0.0


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ deps =
# Use newer canvas-core and widget-base to avoid segfaults on windows
oldest: orange-canvas-core==0.1.28
oldest: orange-widget-base==4.19.0
oldest: orange-spectroscopy==0.6.11
oldest: orange-spectroscopy==0.6.16
oldest: pandas==1.3
oldest: numpy==1.21.0
oldest: scikit-learn==1.0.1
Expand Down

0 comments on commit 802b03a

Please sign in to comment.