Exemplo n.º 1
0
 def test_one_band_em(self):
     em_band = (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)
     em_bands = ((650e-9, 660e-9, 675e-9, 678e-9,
                  680e-9), (780e-9, 785e-9, 790e-9, 800e-9, 812e-9),
                 (1034e-9, 1080e-9, 1100e-9, 1200e-9, 1500e-9))
     # Excitation band should be smaller than the emission band used
     in_exp = [
         ((em_band, (490e-9, 510e-9)), em_band),  # only one band
         ((em_bands, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)),
          em_bands[0]),  # smallest above 500nm
         ((em_bands, (690e-9, 697e-9, 700e-9, 703e-9, 710e-9)),
          em_bands[1]),  # smallest above 700nm
         ((em_bands, (790e-9, 797e-9, 800e-9, 803e-9, 810e-9)),
          em_bands[2]),  # smallest above 800nm
         ((em_bands[0:2], (790e-9, 797e-9, 800e-9, 803e-9, 810e-9)),
          em_bands[1]),  # biggest
         ((em_bands, (790e-9, 797e-9, 800e-9, 803e-9, 810e-9)),
          em_bands[2]),  # smallest above 800nm
         ((em_bands, ((490e-9, 510e-9), (550e-9, 570e-9))), em_bands[0]),
         # It should also work with lists (although not very officially supported
         (([[400e-9, 500e-9],
            [500e-9,
             600e-9]], [490e-9,
                        510e-9]), (500e-9, 600e-9)),  # smallest above 500nm
         # Try with a pass-through
         ((em_band, BAND_PASS_THROUGH), em_band),
         ((em_bands, BAND_PASS_THROUGH), em_bands[-1]),  # biggest
         ((BAND_PASS_THROUGH, (490e-9, 510e-9)), BAND_PASS_THROUGH),
     ]
     for args, exp in in_exp:
         out = fluo.get_one_band_em(*args)
         self.assertEqual(
             exp, out,
             "Failed while running with %s and got %s" % (args, out))
Exemplo n.º 2
0
    def _onNewData(self, dataflow, data):
        # Add some metadata on the fluorescence
        # Just use the best guess as dataio can't do that better
        em_band = fluo.get_one_band_em(self.emission.value, self.excitation.value)
        data.metadata[model.MD_OUT_WL] = em_band

        data.metadata[model.MD_USER_TINT] = self.tint.value
        super(FluoStream, self)._onNewData(dataflow, data)
Exemplo n.º 3
0
    def _onNewData(self, dataflow, data):
        # Add some metadata on the fluorescence
        # Just use the best guess as dataio can't do that better
        em_band = fluo.get_one_band_em(self.emission.value, self.excitation.value)
        data.metadata[model.MD_OUT_WL] = em_band

        data.metadata[model.MD_USER_TINT] = self.tint.value
        super(FluoStream, self)._onNewData(dataflow, data)
Exemplo n.º 4
0
 def test_one_band_em(self):
     em_band = (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)
     em_bands = ((650e-9, 660e-9, 675e-9, 678e-9, 680e-9),
                 (780e-9, 785e-9, 790e-9, 800e-9, 812e-9),
                 (1034e-9, 1080e-9, 1100e-9, 1200e-9, 1500e-9))
     # Excitation band should be smaller than the emission band used
     in_exp = [((em_band, (490e-9, 510e-9)), em_band), # only one band
               ((em_bands, (490e-9, 497e-9, 500e-9, 503e-9, 510e-9)), em_bands[0]), # smallest above 500nm
               ((em_bands, (690e-9, 697e-9, 700e-9, 703e-9, 710e-9)), em_bands[1]), # smallest above 700nm
               ((em_bands, (790e-9, 797e-9, 800e-9, 803e-9, 810e-9)), em_bands[2]), # smallest above 800nm
               ((em_bands[0:2], (790e-9, 797e-9, 800e-9, 803e-9, 810e-9)), em_bands[1]), # biggest
               ((em_bands, (790e-9, 797e-9, 800e-9, 803e-9, 810e-9)), em_bands[2]),  # smallest above 800nm
               ((em_bands, ((490e-9, 510e-9), (550e-9, 570e-9))), em_bands[0]),
               # It should also work with lists (although not very officially supported
               (([[400e-9, 500e-9], [500e-9, 600e-9]], [490e-9, 510e-9]), (500e-9, 600e-9)),  # smallest above 500nm
               ]
     for args, exp in in_exp:
         out = fluo.get_one_band_em(*args)
         self.assertEqual(exp, out, "Failed while running with %s and got %s" % (args, out))