Exemplo n.º 1
0
    def __init__(self, spadic_controller, statusbar, _log=None):
        mutti.Frame.__init__(self, "Hit Logic")
        self._log = _log
        self.control_panels = []

        hitlogic_list = mutti.VList()
        hitlogic_grid = mutti.Grid(2, 2)

        u = spadic_controller.hitlogic
        for (i, d) in enumerate([
          SpadicDial(u, "threshold1", (-256, 255), 4, "Threshold 1",
                     min_width=17),                                
          SpadicDial(u, "threshold2", (-256, 255), 4, "Threshold 2",
                     min_width=17),
          SpadicDial(u, "window", (0, 63), 2, " "*7+"Hit window length",
                     min_width=29),
          SpadicToggle(u, "diffmode", " "*7+"Differential mode",
                       min_width=29),
          ]):
            d._status = statusbar
            hitlogic_grid.adopt(d, row=(i%2), col=(i//2))
            self.control_panels.append(d)
            d._log = _log

        hitlogic_list.adopt(hitlogic_grid)

        selectmask = SelectMaskToggle(u, "mask", statusbar,
                                      min_width=46)
        hitlogic_list.adopt(selectmask)
        selectmask._log = _log
        self.control_panels.append(selectmask)

        self.adopt(hitlogic_list)
Exemplo n.º 2
0
    def __init__(self, spadic_controller, statusbar, _log=None):
        mutti.Frame.__init__(self, "ADC Bias")
        self.control_panels = []
        self._log = _log

        grid = mutti.Grid(3, 3)

        u = spadic_controller.adcbias
        for (i, d) in enumerate([
                SpadicDial(u, "vndel", (0, 127), 3, "VNDel", min_width=13),
                SpadicDial(u, "vpdel", (0, 127), 3, "VPDel", min_width=13),
                SpadicDial(u,
                           "vploadfb", (0, 127),
                           3,
                           "VPLoadFB",
                           min_width=13),
                SpadicDial(u,
                           "vploadfb2", (0, 127),
                           3,
                           "  VPLoadFB2",
                           min_width=16),
                SpadicDial(u, "vpfb", (0, 127), 3, "  VPFB", min_width=16),
                SpadicDial(u, "vpamp", (0, 127), 3, "  VPAmp", min_width=16),
                SpadicDial(u,
                           "baseline", (0, 127),
                           3,
                           "  Baseline",
                           min_width=15),
        ]):
            d._status = statusbar
            d._log = _log
            self.control_panels.append(d)
            grid.adopt(d, row=(i % 3), col=(i // 3))

        self.adopt(grid)
Exemplo n.º 3
0
 def _from_text(self, text):
     try:
         return SpadicDial._from_text(self, text)
     except ValueError:
         try:
             g = {'a': 0, 'b': 1}[text[0].lower()]
             c = int(text[1:].strip(' .'))
             return g*16+c
         except (KeyError, ValueError):
             raise ValueError
Exemplo n.º 4
0
 def __init__(self, stage, *args, **kwargs):
     self.stage = stage
     SpadicDial.__init__(self, *args, **kwargs)
Exemplo n.º 5
0
    def __init__(self, spadic_controller, statusbar, _log=None):
        mutti.Frame.__init__(self, "Filter")
        self._log = _log
        self.control_panels = []

        u = spadic_controller.filter
        grid = mutti.Grid(3, 6)

        for col in range(2, 2 + 3):
            i = col - 1
            d = CoeffDial(i,
                          u,
                          "coeffa", (-32, 31),
                          3,
                          "Coeff. a[%i]" % i,
                          draw_label=False,
                          min_width=5)
            d._log = _log
            d._status = statusbar
            self.control_panels.append(d)
            grid.adopt(d, 0, col)

        for col in range(1, 1 + 4):
            i = col - 1
            d = CoeffDial(i,
                          u,
                          "coeffb", (-32, 31),
                          3,
                          "Coefficient b[%i]" % i,
                          draw_label=False,
                          min_width=5)
            d._log = _log
            d._status = statusbar
            self.control_panels.append(d)
            grid.adopt(d, 1, col)

        d = SpadicDial(u, "scaling", (-256, 255), 4, "  Scaling", min_width=15)
        d._log = _log
        d._status = statusbar
        self.control_panels.append(d)
        grid.adopt(d, 0, 5)

        d = SpadicDial(u, "offset", (-256, 255), 4, "  Offset", min_width=15)
        d._log = _log
        d._status = statusbar
        self.control_panels.append(d)
        grid.adopt(d, 1, 5)

        for (col, w) in zip(range(1, 1 + 5), [5, 5, 5, 5, 15]):
            i = col - 1
            d = EnableStage(i,
                            u,
                            "enable",
                            ("Stage %i" % i) if i < 4 else "Scaling/Offset",
                            draw_label=False,
                            min_width=w)
            d._log = _log
            d._status = statusbar
            self.control_panels.append(d)
            grid.adopt(d, 2, col)

        ca = [grid._panel[(0, col)] for col in range(2, 2 + 3)]
        L = FilterLabel(ca, "Coefficients a")
        grid.adopt(L, 0, 0)

        cb = [grid._panel[(1, col)] for col in range(1, 1 + 4)]
        L = FilterLabel(cb, "Coefficients b")
        grid.adopt(L, 1, 0)

        en = [grid._panel[(2, col)] for col in range(1, 1 + 5)]
        L = FilterLabel(en, "Enable stage")
        grid.adopt(L, 2, 0)

        self.adopt(grid)
Exemplo n.º 6
0
 def __init__(self, stage, *args, **kwargs):
     self.stage = stage
     SpadicDial.__init__(self, *args, **kwargs)
    def __init__(self, group, spadic_controller, statusbar, _log=None):
        mutti.Frame.__init__(self, "Channel settings & Neighbor trigger")
        self.group = group
        self.control_panels = []
        self._log = _log

        upper = 3  # three rows for "upper" neighbor matrix
        lower = 3  # three rows for "lower" neighbor matrix
        col_label = 1  # one column with labels
        num_rows = upper + 16 + lower
        num_cols = 5 + col_label + upper + 16 + lower
        grid = mutti.Grid(num_rows, num_cols)

        t, b = 0, upper
        upper_rows = range(t, b)
        t, b = b, b + 16
        channel_rows = range(t, b)
        t, b = b, b + lower
        lower_rows = range(t, b)

        l, r = 0, 5
        setting_cols = range(l, r)
        l, r = r, r + col_label
        label_cols = range(l, r)
        l, r = r, r + upper
        neighbor_upper_cols = range(l, r)
        l, r = r, r + 16
        neighbor_channel_cols = range(l, r)
        l, r = r, r + lower
        neighbor_lower_cols = range(l, r)

        g = self.group
        # channel settings
        for row in channel_rows:
            i = row - upper + (16 if g == 'B' else 0)
            u_ana = spadic_controller.frontend.channel[i]
            u_dig = spadic_controller.digital.channel[i]
            for (c, d) in enumerate([
                    SpadicToggle(u_ana,
                                 "enablecsa",
                                 "Power CSA [%s.%i]" % (g, i % 16),
                                 draw_label=False,
                                 min_width=3),
                    SpadicDial(u_ana,
                               "baseline", (0, 127),
                               3,
                               "Baseline trim [%s.%i]" % (g, i % 16),
                               draw_label=False,
                               min_width=9),
                    SpadicToggle(u_ana,
                                 "enableadc",
                                 "Connect ADC [%s.%i]" % (g, i % 16),
                                 draw_label=False,
                                 min_width=5),
                    SpadicToggle(u_dig,
                                 "enable",
                                 "Enable logic [%s.%i]" % (g, i % 16),
                                 draw_label=False,
                                 min_width=7),
                    SpadicToggle(u_dig,
                                 "entrigger",
                                 "Trigger input [%s.%i]" % (g, i % 16),
                                 draw_label=False,
                                 min_width=8),
            ]):
                col = c
                d._log = _log
                d._status = statusbar
                self.control_panels.append(d)
                grid.adopt(d, row, col, update_size=False)

        # neighbor matrix
        u = spadic_controller.digital.neighbor[g]
        # -- channels -> upper
        for row in upper_rows:
            for col in neighbor_channel_cols:
                src = col - col_label - 5 - lower
                tgt = "U%i" % row
                s = "%s.%i -> %s.%s" % (g, src, g, tgt)
                t = NeighborMatrixToggle(src,
                                         tgt,
                                         u,
                                         "Neighbor trigger [%s]" % s,
                                         draw_label=False)
                t._status = statusbar
                t._log = _log
                self.control_panels.append(t)
                grid.adopt(t, row, col, update_size=False)
        # -- channels -> channels
        for row in channel_rows:
            for col in neighbor_channel_cols:
                src = col - col_label - 5 - lower
                tgt = row - lower
                if not src == tgt:
                    s = "%s.%i -> %s.%i" % (g, src, g, tgt)
                    t = NeighborMatrixToggle(src,
                                             tgt,
                                             u,
                                             "Neighbor trigger [%s]" % s,
                                             draw_label=False)
                    t._status = statusbar
                    t._log = _log
                    self.control_panels.append(t)
                    grid.adopt(t, row, col, update_size=False)
        # -- channels -> lower
        for row in lower_rows:
            for col in neighbor_channel_cols:
                src = col - col_label - 5 - lower
                tgt = "L%i" % (row - lower - 16)
                s = "%s.%i -> %s.%s" % (g, src, g, tgt)
                t = NeighborMatrixToggle(src,
                                         tgt,
                                         u,
                                         "Neighbor trigger [%s]" % s,
                                         draw_label=False)
                t._status = statusbar
                t._log = _log
                self.control_panels.append(t)
                grid.adopt(t, row, col, update_size=False)
        # -- upper -> channels
        for row in channel_rows:
            for col in neighbor_upper_cols:
                src = "U%i" % (col - col_label - 5)
                tgt = row - lower
                s = "%s.%s -> %s.%i" % (g, src, g, tgt)
                t = NeighborMatrixToggle(src,
                                         tgt,
                                         u,
                                         "Neighbor trigger [%s]" % s,
                                         draw_label=False)
                t._status = statusbar
                t._log = _log
                self.control_panels.append(t)
                grid.adopt(t, row, col, update_size=False)
        # -- lower -> channels
        for row in channel_rows:
            for col in neighbor_lower_cols:
                src = "L%i" % (col - col_label - 5 - upper - 16)
                tgt = row - lower
                s = "%s.%s -> %s.%i" % (g, src, g, tgt)
                t = NeighborMatrixToggle(src,
                                         tgt,
                                         u,
                                         "Neighbor trigger [%s]" % s,
                                         draw_label=False)
                t._status = statusbar
                t._log = _log
                self.control_panels.append(t)
                grid.adopt(t, row, col, update_size=False)

        # labels
        for (col, setting) in zip(
                setting_cols,
            ["CSA", "  Baseline", "  ADC", "  Logic", "  Trigger  "]):
            p = [grid._panel[(row, col)] for row in channel_rows]
            L = FilterLabel(p, setting)
            grid.adopt(L, upper - 1, col, update_size=False)
        label_col = label_cols[0]
        for row in channel_rows:
            p = [
                grid._panel[(row, col)]
                for col in setting_cols + neighbor_lower_cols +
                neighbor_channel_cols + neighbor_upper_cols
                if (row, col) in grid._panel
            ]
            i = row - upper
            L = FilterLabel(p, "%s.%i  " % (g, i))
            grid.adopt(L, row, label_col, update_size=False)
        for row in upper_rows:
            p = [grid._panel[(row, col)] for col in neighbor_channel_cols]
            s = "U%i" % row
            L = FilterLabel(p, "%s.%s  " % (g, s))
            grid.adopt(L, row, label_col, update_size=False)
        for row in lower_rows:
            p = [grid._panel[(row, col)] for col in neighbor_channel_cols]
            s = "L%i" % (row - upper - 16)
            L = FilterLabel(p, "%s.%s  " % (g, s))
            grid.adopt(L, row, label_col, update_size=False)

        grid.update_size()
        self.adopt(grid)