def test_domain_conversion(self): """Test whether a domain can be used for conversion.""" data = Transmittance()(Orange.data.Table("collagen.csv")) absorbance = Absorbance()(data) nt = Orange.data.Table.from_table(absorbance.domain, data) self.assertEqual(absorbance.domain, nt.domain) np.testing.assert_equal(absorbance.X, nt.X) np.testing.assert_equal(absorbance.Y, nt.Y)
def test_roundtrip(self): """Test TR -> AB -> TR calculation""" # actually AB -> TR -> AB -> TR data = Transmittance()(Orange.data.Table("collagen.csv")) calcdata = Transmittance()(Absorbance()(data)) np.testing.assert_allclose(data.X, calcdata.X)
def test_roundtrip(self): """Test AB -> TR -> AB calculation""" data = Orange.data.Table("collagen.csv") calcdata = Absorbance()(Transmittance()(data)) np.testing.assert_allclose(data.X, calcdata.X)
from Orange.widgets.utils.annotated_data import get_next_name from orangecontrib.infrared.data import getx from orangecontrib.infrared.preprocess import Absorbance, Transmittance, \ Integrate, Interpolate, Cut, SavitzkyGolayFiltering, \ GaussianSmoothing, PCADenoising, RubberbandBaseline, \ Normalize # Preprocessors that work per sample and should return the same # result for a sample independent of the other samples PREPROCESSORS_INDEPENDENT_SAMPLES = [ Interpolate(np.linspace(1000, 1700, 100)), SavitzkyGolayFiltering(window=9, polyorder=2, deriv=2), Cut(lowlim=1000, highlim=1800), GaussianSmoothing(sd=3.), Absorbance(), Transmittance(), Integrate(limits=[[900, 100], [1100, 1200], [1200, 1300]]), Integrate(methods=Integrate.Simple, limits=[[1100, 1200]]), Integrate(methods=Integrate.Baseline, limits=[[1100, 1200]]), Integrate(methods=Integrate.PeakMax, limits=[[1100, 1200]]), Integrate(methods=Integrate.PeakBaseline, limits=[[1100, 1200]]), Integrate(methods=Integrate.PeakAt, limits=[[1100]]), Integrate(methods=Integrate.PeakX, limits=[[1100, 1200]]), Integrate(methods=Integrate.PeakXBaseline, limits=[[1100, 1200]]), RubberbandBaseline(), Normalize(method=Normalize.Vector), Normalize(method=Normalize.Area, int_method=Integrate.PeakMax, lower=0, upper=10000), ] # Preprocessors that use groups of input samples to infer