コード例 #1
0
ファイル: cmdline.py プロジェクト: hsatoshi/pxar
    def plot_map(self,data,name,count=False):
        if(not self.window):
            print data
            return

        # Find number of ROCs present:
        module = False
        for px in data:
            if px.roc > 0:
                module = True
                break

        # Prepare new numpy matrix:
        d = zeros((416 if module else 52,160 if module else 80))

        for px in data:
            xoffset = 52*(px.roc%8) if module else 0
            yoffset = 80*int(px.roc/8) if module else 0
            # Flip the ROCs upside down:
            y = (px.row + yoffset) if (px.roc < 8) else (2*yoffset - px.row - 1)
            # Reverse order of the upper ROC row:
            x = (px.column + xoffset) if (px.roc < 8) else (415 - xoffset - px.column)
            d[x][y] += 1 if count else px.value

        plot = Plotter.create_th2(d, 0, 415 if module else 51, 0, 159 if module else 79, name, 'pixels x', 'pixels y', name)
        self.window.histos.append(plot)
        self.window.update()
コード例 #2
0
    def plot_map(self, data, name, count=False):
        if (not self.window):
            print data
            return

        # Find number of ROCs present:
        module = False
        for px in data:
            if px.roc > 0:
                module = True
                break

        # Prepare new numpy matrix:
        d = zeros((416 if module else 52, 160 if module else 80))

        for px in data:
            xoffset = 52 * (px.roc % 8) if module else 0
            yoffset = 80 * int(px.roc / 8) if module else 0
            # Flip the ROCs upside down:
            y = (px.row + yoffset) if (px.roc < 8) else (2 * yoffset - px.row -
                                                         1)
            # Reverse order of the upper ROC row:
            x = (px.column + xoffset) if (px.roc < 8) else (415 - xoffset -
                                                            px.column)
            d[x][y] += 1 if count else px.value

        plot = Plotter.create_th2(d, 0, 415 if module else 51, 0,
                                  159 if module else 79, name, 'pixels x',
                                  'pixels y', name)
        self.window.histos.append(plot)
        self.window.update()
コード例 #3
0
ファイル: cmdline.py プロジェクト: hsatoshi/pxar
    def plot_2d(self,data,name,dac1,step1,min1,max1,dac2,step2,min2,max2):
        if(not self.window):
            for idac, dac in enumerate(data):
                dac1 = min1 + (idac/((max2-min2)/step2+1))*step1
                dac2 = min2 + (idac%((max2-min2)/step2+1))*step2
                s = "DACs " + str(dac1) + ":" + str(dac2) + " - "
                for px in dac:
                    s += str(px)
                print s
            return
        
        # Prepare new numpy matrix:
        bins1 = (max1-min1)/step1+1
        bins2 = (max2-min2)/step2+1
        d = zeros((bins1,bins2))

        for idac, dac in enumerate(data):
            if(dac):
                bin1 = (idac/((max2-min2)/step2+1))
                bin2 = (idac%((max2-min2)/step2+1))
                d[bin1][bin2] = dac[0].value

        plot = Plotter.create_th2(d, min1, max1, min2, max2, name, dac1, dac2, name)
        self.window.histos.append(plot)
        self.window.update()
コード例 #4
0
    def plot_2d(self, data, name, dac1, step1, min1, max1, dac2, step2, min2,
                max2):
        if (not self.window):
            for idac, dac in enumerate(data):
                dac1 = min1 + (idac / ((max2 - min2) / step2 + 1)) * step1
                dac2 = min2 + (idac % ((max2 - min2) / step2 + 1)) * step2
                s = "DACs " + str(dac1) + ":" + str(dac2) + " - "
                for px in dac:
                    s += str(px)
                print s
            return

        # Prepare new numpy matrix:
        bins1 = (max1 - min1) / step1 + 1
        bins2 = (max2 - min2) / step2 + 1
        d = zeros((bins1, bins2))

        for idac, dac in enumerate(data):
            if (dac):
                bin1 = (idac / ((max2 - min2) / step2 + 1))
                bin2 = (idac % ((max2 - min2) / step2 + 1))
                d[bin1][bin2] = dac[0].value

        plot = Plotter.create_th2(d, min1, max1, min2, max2, name, dac1, dac2,
                                  name)
        self.window.histos.append(plot)
        self.window.update()