Пример #1
0
    def test_logical_channel(self):
        name = u'₩€_name_$$'
        ill_val = u'πλζ.test.ζ'
        fluor = u'GFP-₹₹'
        binning_value = u'Φωλ'
        ph_size = 1.11
        ph_units = UnitsLength.MICROMETER
        ex_wave = 3.34
        ex_units = UnitsLength.ANGSTROM
        version = 123
        zoom = 100
        gain = 1010.23
        di_model = u'Model_ 123_àÅÉ'

        obj = LogicalChannelI()
        obj.name = rstring(name)
        obj.pinHoleSize = LengthI(ph_size, ph_units)
        illumination = IlluminationI()
        illumination.value = rstring(ill_val)
        obj.illumination = illumination
        obj.excitationWave = LengthI(ex_wave, ex_units)
        obj.setFluor(rstring(fluor))

        ds = DetectorSettingsI()
        ds.version = rint(version)
        ds.gain = rdouble(gain)
        ds.zoom = rdouble(zoom)
        binning = BinningI()
        binning.value = rstring(binning_value)
        ds.binning = binning
        obj.detectorSettings = ds

        dichroic = DichroicI()
        dichroic.model = rstring(di_model)
        light_path = LightPathI()
        light_path.dichroic = dichroic
        obj.lightPath = light_path

        class MockChannel(LogicalChannelWrapper):
            def __loadedHotSwap__(self):
                # Don't need to load data for getLightPath()
                pass

        channel = MockChannel(None, obj)
        assert channel.getName() == name.encode('utf8')
        assert channel.name == name
        assert channel.getPinHoleSize().getValue() == ph_size
        assert channel.getPinHoleSize().getUnit() == ph_units
        assert channel.getPinHoleSize().getSymbol() == 'µm'
        # Illumination is an enumeration
        assert channel.getIllumination().getValue() == ill_val.encode('utf8')
        assert channel.getExcitationWave().getValue() == ex_wave
        assert channel.getExcitationWave().getUnit() == ex_units
        assert channel.getExcitationWave().getSymbol() == 'Å'
        assert channel.getFluor() == fluor
        assert channel.fluor == fluor

        d_settings = channel.getDetectorSettings()
        assert d_settings.getVersion() == version
        assert d_settings.version == version
        assert d_settings.getGain() == gain
        assert d_settings.gain == gain
        assert d_settings.getZoom() == zoom
        assert d_settings.getBinning().getValue() == binning_value
        assert d_settings.getBinning().value == binning_value
        assert channel.getLightPath().getDichroic().getModel() == di_model