Exemplo n.º 1
0
 def test_to_readable_band(self):
     # inputs, expected
     in_exp = [((490e-9, 510e-9), "500/20 nm"),  # 2-float band
               (((490e-9, 510e-9), (590e-9, 610e-9)), "500, 600 nm"), # multi-band
               ("pass-through", u"pass-through"), # just a string
               ]
     for arg, exp in in_exp:
         out = fluo.to_readable_band(arg)
         self.assertEqual(exp, out, "Failed while running with %s and got %s" % (arg, out))
Exemplo n.º 2
0
def to_readable_band(v):
    """
    Convert a list of choices to readable bands for the GUI
    """
    if (isinstance(v, (tuple, list)) and len(v) > 1 and
            all(isinstance(c, numbers.Real) for c in v)):
        return fluo.to_readable_band(v)
    else:
        return v
Exemplo n.º 3
0
 def test_to_readable_band(self):
     # inputs, expected
     in_exp = [
         ((490e-9, 510e-9), "500/20 nm"),  # 2-float band
         (((490e-9, 510e-9), (590e-9, 610e-9)),
          "500, 600 nm"),  # multi-band
         (BAND_PASS_THROUGH, u"pass-through"),  # just a string
     ]
     for arg, exp in in_exp:
         out = fluo.to_readable_band(arg)
         self.assertEqual(
             exp, out,
             "Failed while running with %s and got %s" % (arg, out))
Exemplo n.º 4
0
 def to_readable_band(v):
     if (isinstance(v, (tuple, list)) and len(v) > 1 and
             all(isinstance(c, numbers.Real) for c in v)):
         return fluo.to_readable_band(v)
     else:
         return v
Exemplo n.º 5
0
 def to_readable_band(v):
     if (isinstance(v, (tuple, list)) and len(v) > 1 and
             all(isinstance(c, numbers.Real) for c in v)):
         return fluo.to_readable_band(v)
     else:
         return v