Skip to content

Commit

Permalink
refactor CurveShift/LinearTransform preprocessor tests to include the…
Browse files Browse the repository at this point in the history
… scale factor
  • Loading branch information
matyson committed May 3, 2024
1 parent 0fe6f71 commit e5ba0a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions orangecontrib/spectroscopy/tests/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from orangecontrib.spectroscopy.preprocess import Absorbance, Transmittance, \
Integrate, Interpolate, Cut, SavitzkyGolayFiltering, \
GaussianSmoothing, PCADenoising, RubberbandBaseline, \
Normalize, LinearBaseline, CurveShift, EMSC, MissingReferenceException, \
Normalize, LinearBaseline, LinearTransform, EMSC, MissingReferenceException, \
WrongReferenceException, NormalizeReference, XASnormalization, ExtractEXAFS, \
PreprocessException, NormalizePhaseReference, Despike, SpSubtract
from orangecontrib.spectroscopy.preprocess.als import ALSP, ARPLS, AIRPLS
Expand Down Expand Up @@ -58,7 +58,7 @@ def preprocessor_data(preproc):
Normalize(method=Normalize.Vector),
Normalize(method=Normalize.Area, int_method=Integrate.PeakMax, lower=0, upper=10000),
Normalize(method=Normalize.MinMax),
CurveShift(1),
LinearTransform(1, 2),
Despike(threshold=5, cutoff=60, dis=5),
ALSP(lam=100E+6, itermax=5, p=0.5),
ARPLS(lam=100E+5, itermax=5, ratio=0.5),
Expand Down Expand Up @@ -588,14 +588,14 @@ def test_iris(self):
[4.75015528, 3.15366444, 1.46254138, 0.23693223]])


class TestCurveShift(unittest.TestCase):
class TestLinearTransform(unittest.TestCase):

def test_simple(self):
data = Table.from_numpy(None, [[1.0, 2.0, 3.0, 4.0]])
f = CurveShift(amount=1.1)
f = LinearTransform(amount=1.1, scale=2.)
fdata = f(data)
np.testing.assert_almost_equal(fdata.X,
[[2.1, 3.1, 4.1, 5.1]])
[[3.1, 5.1, 7.1, 9.1]])


class TestUtils(unittest.TestCase):
Expand Down

0 comments on commit e5ba0a9

Please sign in to comment.