def test_estimate(self): # inputs, expected in_exp = [((500e-9, (490e-9, 510e-9)), fluo.FIT_GOOD), # 2-float band ((500e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_GOOD), # 5-float band ((489e-9, (490e-9, 510e-9)), fluo.FIT_BAD), # almost good ((489e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_BAD), # almost good ((515e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_BAD), # almost good ((900e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_IMPOSSIBLE), # really bad ] for args, exp in in_exp: out = fluo.estimate_fit_to_dye(*args) self.assertEqual(exp, out, "Failed while running with %s and got %s" % (args, out))
def test_quantify(self): """ compare quantify and fit """ # inputs, expected ins = [(500e-9, (490e-9, 510e-9)), (500e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (489e-9, (490e-9, 510e-9)), (489e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (515e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (900e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), ] for args in ins: est = fluo.estimate_fit_to_dye(*args) quant = fluo.quantify_fit_to_dye(*args) if quant == 0: self.assertEqual(est, fluo.FIT_IMPOSSIBLE) else: self.assertIn(est, {fluo.FIT_BAD, fluo.FIT_GOOD})
def test_estimate(self): # inputs, expected in_exp = [ ((500e-9, (490e-9, 510e-9)), fluo.FIT_GOOD), # 2-float band ((500e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_GOOD), # 5-float band ((489e-9, (490e-9, 510e-9)), fluo.FIT_BAD), # almost good ((489e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_BAD), # almost good ((515e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_BAD), # almost good ((900e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), fluo.FIT_IMPOSSIBLE), # really bad ] for args, exp in in_exp: out = fluo.estimate_fit_to_dye(*args) self.assertEqual( exp, out, "Failed while running with %s and got %s" % (args, out))
def test_quantify(self): """ compare quantify and fit """ # inputs ins = [(500e-9, (490e-9, 510e-9)), (500e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (489e-9, (490e-9, 510e-9)), (489e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (515e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (900e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (500e-9, BAND_PASS_THROUGH)] for args in ins: est = fluo.estimate_fit_to_dye(*args) quant = fluo.quantify_fit_to_dye(*args) if quant < 1e4: # Just rough estimate self.assertEqual(est, fluo.FIT_IMPOSSIBLE) else: self.assertIn(est, {fluo.FIT_BAD, fluo.FIT_GOOD})
def test_quantify(self): """ compare quantify and fit """ # inputs, expected ins = [ (500e-9, (490e-9, 510e-9)), (500e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (489e-9, (490e-9, 510e-9)), (489e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (515e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), (900e-9, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), ] for args in ins: est = fluo.estimate_fit_to_dye(*args) quant = fluo.quantify_fit_to_dye(*args) if quant == 0: self.assertEqual(est, fluo.FIT_IMPOSSIBLE) else: self.assertIn(est, {fluo.FIT_BAD, fluo.FIT_GOOD})