Exemplo n.º 1
0
    def __init__(self,
                 parent,
                 device,
                 ctrls,
                 names,
                 is_orb,
                 prefix='',
                 acc='SI'):
        """."""
        super(BaseWidget, self).__init__(parent)
        self.setObjectName(acc.upper() + 'App')
        self.EXT = f'.{acc.lower()}dorb'
        self.EXT_FLT = f'Sirius Delta Orbit Files (*.{acc.lower()}dorb)'
        self.line_names = names
        self.prefix = prefix
        self.device = _PVName(device)
        self.devpref = self.device.substitute(prefix=prefix)
        self.controls = ctrls
        self._csorb = SOFBFactory.create(acc)
        self.update_rate = 2.1  # Hz
        self.last_dir = self.DEFAULT_DIR
        self.is_orb = is_orb
        self.timer = QTimer()
        self.thread = QThread()
        self.updater = []
        self.graph = {'x': None, 'y': None}
        for _ in range(2):
            upd = UpdateGraph(ctrls, is_orb, acc)
            upd.moveToThread(self.thread)
            self.timer.timeout.connect(upd.update_graphic)
            self.updater.append(upd)

        self.setupui()
        self.connect_signals()

        prefx, prefy = ('BPMX', 'BPMY') if self.is_orb else ('CH', 'CV')
        self.enbl_pvs = {
            'x':
            _ConnSig(self.devpref.substitute(propty=prefx + 'EnblList-RB')),
            'y':
            _ConnSig(self.devpref.substitute(propty=prefy + 'EnblList-RB'))
        }
        for pln, signal in self.enbl_pvs.items():
            sig = signal.new_value_signal[_np.ndarray]
            for upd in self.updater:
                sig.connect(_part(upd.set_enbl_list, pln))

        self.enbl_pvs_set = {
            'x':
            _ConnSig(self.devpref.substitute(propty=prefx + 'EnblList-SP')),
            'y':
            _ConnSig(self.devpref.substitute(propty=prefy + 'EnblList-SP'))
        }

        self.thread.start()
        self.timer.start(1000 / self.update_rate)
Exemplo n.º 2
0
    def __init__(self, parent, device, prefix='', acc='SI'):
        super().__init__(parent, device, prefix=prefix, acc=acc)
        self.setupui()
        self._config_type = acc.lower() + '_orbcorr_respm'
        self._client = ConfigDBClient(config_type=self._config_type)
        self.EXT = self._csorb.respmat_fname.split('.')[1]
        self.EXT_FLT = 'RespMat Files (*.{})'.format(self.EXT)
        self.last_dir = self.DEFAULT_DIR

        self._respmat_sp = _ConnSig(
            self.devpref.substitute(propty='RespMat-SP'))
        self._respmat_rb = _ConnSig(
            self.devpref.substitute(propty='RespMat-RB'))
Exemplo n.º 3
0
 def __init__(self,
              parent=None,
              pslist=[],
              name='',
              delta=0.0,
              idxini=0,
              idxfin=4000,
              legend=False):
     super().__init__(parent)
     self._pvslist = pslist
     self.name = name
     self._legend = legend
     self._idx_ini = idxini
     self._idx_fin = idxfin
     self._delta = delta
     self.curves = []
     self.setupui()
     self.setFocus(True)
     self.setFocusPolicy(Qt.StrongFocus)
     self.chans = [
         _ConnSig(
             _PVName(ps).substitute(prefix=_VACA_PREFIX, propty='Wfm-Mon'))
         for ps in pslist
     ]
     for idx, chan in enumerate(self.chans):
         chan.new_value_signal[_np.ndarray].connect(
             _part(self._update_curve, idx))
Exemplo n.º 4
0
    def add_kicklimits_curves(self):
        grpbx = QGroupBox('Show Kick Limits', self)
        vbl = QHBoxLayout(grpbx)
        self.hbl_namev.addWidget(grpbx)
        chcbox1 = QCheckBox('Kicks', grpbx)
        chcbox2 = QCheckBox('Delta Kicks', grpbx)
        chcbox1.setChecked(True)
        chcbox2.setChecked(True)
        vbl.addWidget(chcbox1)
        vbl.addWidget(chcbox2)

        chcboxs = (chcbox1, chcbox2)
        names = ('Max Kicks', 'Max dKickx')
        pvs = ('MaxKick', 'MaxDeltaKick')
        stys = (4, 2)
        wids = (3, 2)
        plns = ('x', 'y')
        corrs = ('CH', 'CV')
        for chb, name, pvi, sty, wid in zip(chcboxs, names, pvs, stys, wids):
            pen = mkPen(QColor(0, 0, 0))
            pen.setStyle(sty)
            pen.setWidth(wid)
            for pln, corr in zip(plns, corrs):
                maxkick = InfLine(
                    conv=1e-6, pos=0.0, pen=pen, angle=0, name=name)
                minkick = InfLine(conv=-1e-6, pos=0.0, pen=pen, angle=0)
                self.graph[pln].addItem(maxkick)
                self.graph[pln].addItem(minkick)
                chan = _ConnSig(
                    self.devpref.substitute(propty=pvi + corr + '-RB'))
                self._chans.append(chan)
                chan.new_value_signal[float].connect(maxkick.setValue)
                chan.new_value_signal[float].connect(minkick.setValue)
                chb.toggled.connect(maxkick.setVisible)
                chb.toggled.connect(minkick.setVisible)
Exemplo n.º 5
0
 def __init__(self, parent, device, acc, prefix=''):
     super().__init__(parent)
     self.prefix = prefix
     self.device = _PVName(device)
     self.devpref = self.device.substitute(prefix=prefix)
     self.acc = acc.upper()
     self.setObjectName(self.acc + 'App')
     self._csorb = SOFBFactory.create(acc)
     self._inflines = []
     self.setupui()
     self.mat = _ConnSig(self.devpref.substitute(propty='RespMat-Mon'))
     self.mat.new_value_signal[_np.ndarray].connect(self._update_graph)
     self.rsize = _ConnSig(self.devpref.substitute(propty='RingSize-RB'))
     self.rsize.new_value_signal[int].connect(self._update_horizontal)
     self._update_horizontal(None)
     self._update_graph(None)
Exemplo n.º 6
0
    def get_default_ctrls(device, prefix='', acc='SI'):
        """."""
        pvs = [
            'SPassOrbX-Mon', 'SPassOrbY-Mon', 'OfflineOrbX-RB',
            'OfflineOrbY-RB', 'RefOrbX-RB', 'RefOrbY-RB'
        ]
        orbs = ['IOC-SPassOrb', 'IOC-OfflineOrb', 'IOC-RefOrb']
        if acc.upper() == 'SI':
            pvs.extend(['SlowOrbX-Mon', 'SlowOrbY-Mon'])
            orbs.append('IOC-SlowOrb')
        if acc.upper() in {'SI', 'BO'}:
            pvs.extend(['MTurnIdxOrbX-Mon', 'MTurnIdxOrbY-Mon'])
            orbs.append('IOC-MTurnOrb')

        chans = [
            _ConnSig(device.substitute(prefix=prefix, propty=pv)) for pv in pvs
        ]
        ctrls = dict()
        pvs = iter(chans)
        for orb in orbs:
            pvi = next(pvs)
            pvj = next(pvs)
            ctrls[orb] = {
                'x': {
                    'signal': pvi.new_value_signal,
                    'getvalue': pvi.getvalue
                },
                'y': {
                    'signal': pvj.new_value_signal,
                    'getvalue': pvj.getvalue
                }
            }
        return chans, ctrls
Exemplo n.º 7
0
 def __init__(self, parent, device, prefix=''):
     super().__init__(parent)
     self.prefix = prefix
     self.device = _PVName(device)
     self.devpref = self.device.substitute(prefix=prefix)
     self.setObjectName(self.device.sec + 'App')
     self._chan = _ConnSig(
         self.devpref.substitute(propty='NrSingValues-Mon'))
     self.setupui()
Exemplo n.º 8
0
 def __init__(self, device, prefix='', **kwargs):
     """."""
     self._reforb = None
     super().__init__(**kwargs)
     self.setObjectName('graph')
     self.setStyleSheet('#graph {min-height: 15em; min-width: 20em;}')
     self.prefix = prefix
     self.device = _PVName(device)
     self.devpref = self.device.substitute(prefix=prefix)
     self.multiturnidx = _ConnSig(
         self.devpref.substitute(propty='MTurnIdx-SP'))
Exemplo n.º 9
0
 def __init__(self, parent, device, prefix='', orbtype='sum', csorb=None):
     """."""
     super().__init__(parent)
     self.prefix = prefix
     self.device = _PVName(device)
     self.devpref = self.device.substitute(prefix=prefix)
     self.orbtype = orbtype.lower()
     self._csorb = csorb
     self.setObjectName(self.device.sec + 'App')
     self.multiturnidx = _ConnSig(
         self.devpref.substitute(propty='MTurnIdx-SP'))
     self.setupui()
Exemplo n.º 10
0
 def get_default_ctrls(device, prefix=''):
     basename = device.substitute(prefix=prefix)
     chans = [
         _ConnSig(basename.substitute(propty='DeltaKickCH-Mon')),
         _ConnSig(basename.substitute(propty='DeltaKickCV-Mon')),
         _ConnSig(basename.substitute(propty='KickCH-Mon')),
         _ConnSig(basename.substitute(propty='KickCV-Mon'))]
     ctrls = {
         'Delta Kicks': {
             'x': {
                 'signal': chans[0].new_value_signal,
                 'getvalue': chans[0].getvalue},
             'y': {
                 'signal': chans[1].new_value_signal,
                 'getvalue': chans[1].getvalue}},
         'Kicks': {
             'x': {
                 'signal': chans[2].new_value_signal,
                 'getvalue': chans[2].getvalue},
             'y': {
                 'signal': chans[3].new_value_signal,
                 'getvalue': chans[3].getvalue}},
         }
     return chans, ctrls
Exemplo n.º 11
0
 def __init__(self, parent, device, prefix='', acc=None, nr_registers=9):
     """."""
     super(OrbitRegisters, self).__init__(parent)
     self._nr_registers = nr_registers
     self.prefix = prefix
     self.device = _PVName(device)
     self.devpref = self.device.substitute(prefix=prefix)
     self.acc = acc.upper()
     self._orbits = {
         'ref': [
             _ConnSig(self.devpref.substitute(propty='RefOrbX-RB')),
             _ConnSig(self.devpref.substitute(propty='RefOrbY-RB'))
         ],
         'sp': [
             _ConnSig(self.devpref.substitute(propty='SPassOrbX-Mon')),
             _ConnSig(self.devpref.substitute(propty='SPassOrbY-Mon'))
         ],
         'off': [
             _ConnSig(self.devpref.substitute(propty='OfflineOrbX-SP')),
             _ConnSig(self.devpref.substitute(propty='OfflineOrbY-SP'))
         ],
         'bpm': [
             _ConnSig(self.devpref.substitute(propty='BPMOffsetX-Mon')),
             _ConnSig(self.devpref.substitute(propty='BPMOffsetY-Mon'))
         ],
         'mat':
         _ConnSig(self.devpref.substitute(propty='RespMat-RB')),
     }
     if self.acc == 'SI':
         self._orbits['orb'] = [
             _ConnSig(self.devpref.substitute(propty='SlowOrbX-Mon')),
             _ConnSig(self.devpref.substitute(propty='SlowOrbY-Mon'))
         ]
     if self.acc in {'SI', 'BO'}:
         self._orbits['mti'] = [
             _ConnSig(self.devpref.substitute(propty='MTurnIdxOrbX-Mon')),
             _ConnSig(self.devpref.substitute(propty='MTurnIdxOrbY-Mon'))
         ]
     self.setupui()