Exemplo n.º 1
0
        def __call__(self, frame):
            if self.sent:
                return
            if frame.type == core.G3FrameType.Wiring:
                self.wiringframe = frame
                return []
            elif frame.type == core.G3FrameType.Calibration:
                self.calframe = frame
                return []
            elif frame.type != core.G3FrameType.Timepoint:
                # Just pass this along...
                return

            if self.calframe is None or self.wiringframe is None:
                raise Exception('Data before wiring and cal frames!')
            w = self.wiringframe['WiringMap']
            del self.wiringframe['WiringMap']
            c = self.calframe['NominalBolometerProperties']

            new_wiring = dfmux.DfMuxWiringMap()
            for k, d in w.iteritems():
                new_wiring[c[k].physical_name] = d
            self.wiringframe['WiringMap'] = new_wiring

            self.sent = True
            return [self.wiringframe, frame]
Exemplo n.º 2
0
    def trim_wiring_map(fr):
        if fr.type != core.G3FrameType.Wiring:
            return

        fr['OriginalWiringMap'] = fr['WiringMap']
        del fr['WiringMap']
        keys_to_keep = set()
        for item in args.pathstring:
            keys_to_keep |= set(
                fnmatch.filter(fr['OriginalWiringMap'].keys(), item))
        new_wiring = dfmux.DfMuxWiringMap()
        for k in keys_to_keep:
            new_wiring[k] = fr['OriginalWiringMap'][k]
        fr['WiringMap'] = new_wiring
        print('Taking data from %d/%d detectors' %
              (len(keys_to_keep), len(fr['OriginalWiringMap'])))