Exemple #1
0
 def setChannel(self, channel):
     '''
     Set the cutter's channel for future rows. 
     '''
     self.channel = channel
     self.objectTemplate = mapObjects(channel)
     self.needReorder = self.cuts.needReorder(self.channel)
    def fakeObjectForChannel(self, channel):
        '''
        Get the odd object out for this channel (the l in Z+l).
        E.g. 'm3' for channel 'mmm' or 'e' for channel 'emm'.
        '''
        try:
            return self._fakeRateCalculator_channelObjMap_[channel]
        except KeyError:
            assert len(channel) == 3 and any(channel.count(ob)>1 for ob in channel),\
                "Only Z+l-like channels are allowed, %s will not work!"%channel

            objects = mapObjects(channel)
            for obj in objects:
                if len(obj) == 1: # only object of its type
                    self._fakeRateCalculator_channelObjMap_[channel] = obj
                    return obj
                if obj[-1] == '3': # Z always listed first for lll channels
                    self._fakeRateCalculator_channelObjMap_[channel] = obj
                    return obj
            else: # shouldn't ever happen
                raise