def test_domain_conversion(self): """Test whether a domain can be used for conversion.""" data = Transmittance()(SMALL_COLLAGEN) 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_domain_conversion(self): """Test whether a domain can be used for conversion.""" data = Orange.data.Table("collagen.csv") transmittance = Transmittance()(data) nt = Orange.data.Table.from_table(transmittance.domain, data) self.assertEqual(transmittance.domain, nt.domain) np.testing.assert_equal(transmittance.X, nt.X) np.testing.assert_equal(transmittance.Y, nt.Y)
def test_roundtrip(self): """Test TR -> AB -> TR calculation""" # actually AB -> TR -> AB -> TR data = Transmittance()(SMALL_COLLAGEN) calcdata = Transmittance()(Absorbance()(data)) np.testing.assert_allclose(data.X, calcdata.X)
def test_roundtrip(self): """Test AB -> TR -> AB calculation""" data = SMALL_COLLAGEN calcdata = Absorbance()(Transmittance()(data)) np.testing.assert_allclose(data.X, calcdata.X)
Very slow preprocessors should get smaller files. """ if isinstance(preproc, ME_EMSC): return SMALLER_COLLAGEN return SMALL_COLLAGEN # 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(), LinearBaseline(), Normalize(method=Normalize.Vector), Normalize(method=Normalize.Area, int_method=Integrate.PeakMax, lower=0, upper=10000),
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)