Esempio n. 1
0
 def __init__(self,
              call_upon_completion,
              name,
              it_id,
              step,
              n_mesh,
              prg,
              resp_type='coords'):
     super(CorMeasure, self).__init__()
     self.chans = {'Iset': None, 'Imes': None}
     self.val = {'Iset': None, 'Imes': None, 'time': None}
     self.name = name
     self.id = it_id
     self.init_val = None
     self.step = step
     self.n_mesh = -1 * n_mesh
     self.prg = prg
     self.stop = n_mesh + 1
     self.response = None
     self.std_err = None
     self.status = None
     self.flag = False
     self.time_flag = False
     self.err_flag = False
     self.data_flag = True
     self.time_stamp = 0
     self.resp_type = resp_type
     self.callback = call_upon_completion
     self.chan_resps = {
         'coords':
         cda.VChan('cxhw:4.bpm_preproc.orbit', max_nelems=64),
         'tunes':
         cda.VChan('cxhw:4.bpm_preproc.tunes', max_nelems=2, on_update=1)
     }
     self.cor_data_resps = {
         'coords': np.zeros([
             32,
         ]),
         'tunes': np.zeros([
             2,
         ])
     }
     self.cor_std = np.zeros([
         32,
     ])
     for chan in ['Iset', 'Imes']:
         cor_chan = cda.DChan(name + '.' + chan)
         cor_chan.valueMeasured.connect(self.val_change)
         self.chans[chan] = cor_chan
     self.cor_data = self.cor_data_resps[resp_type]
     self.chan_data = self.chan_resps[resp_type]
     self.chan_data.valueMeasured.connect(self.data_proc)
Esempio n. 2
0
    def __init__(self,
                 data_receiver,
                 chan_name,
                 source,
                 inf_type,
                 n_elems=200):
        super(CXDataExchange, self).__init__()
        self.data_receiver = data_receiver
        self.source = source
        self.inf_type = inf_type
        self.chan_data = cda.VChan(chan_name, max_nelems=n_elems)

        self.chan_data.valueMeasured.connect(self.data_proc)
Esempio n. 3
0
    def __init__(self):
        super(Test, self).__init__()
        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
        uic.loadUi("settings.ui", self)
        self.setWindowTitle('Settings')
        self.show()

        self.cur_bpm = 'bpm01'
        self.chan_bpm_vals = {'bpm01': {}, 'bpm02': {}, 'bpm03': {}, 'bpm04': {}, 'bpm05': {}, 'bpm07': {}, 'bpm08': {},
                              'bpm09': {}, 'bpm10': {}, 'bpm11': {}, 'bpm12': {}, 'bpm13': {}, 'bpm14': {}, 'bpm15': {},
                              'bpm16': {}, 'bpm17': {}}
        self.chan_bpm_vals_env = {'bpm01': {}, 'bpm02': {}, 'bpm03': {}, 'bpm04': {}, 'bpm05': {}, 'bpm07': {}, 'bpm08': {},
                                  'bpm09': {}, 'bpm10': {}, 'bpm11': {}, 'bpm12': {}, 'bpm13': {}, 'bpm14': {}, 'bpm15': {},
                                  'bpm16': {}, 'bpm17': {}}
        print('start')
        for bpm, bpm_coor in self.chan_bpm_vals.items():
            for i in range(4):
                chan = cda.VChan('cxhw:37.ring.' + bpm + '.line' + str(i), max_nelems=4096)
                chan.valueMeasured.connect(self.data_proc)
                self.chan_bpm_vals[bpm].update({i: chan})
            chan_env = cda.VChan('cxhw:37.ring.' + bpm + '.dataenvl', max_nelems=512)
            chan_env.valueMeasured.connect(self.data_proc_env)
            self.chan_bpm_vals_env[bpm].update({0: chan_env})

        self.plot = pg.PlotWidget()
        self.plot.showGrid(x=True, y=True)
        self.plot.setRange(yRange=[0, 400])
        self.plot_env = pg.PlotWidget()
        self.plot_env.showGrid(x=True, y=True)
        p = QHBoxLayout()
        self.widget.setLayout(p)
        p.addWidget(self.plot)
        p.addWidget(self.plot_env)

        self.cur_lines = {'0': np.ones([100, ]), '1': np.ones([100, ]), '2': np.ones([100, ]), '3': np.ones([100, ])}

        self.comboBox.currentTextChanged.connect(self.bpm_changed)
Esempio n. 4
0
    def chans_connect(self, chans, values, names, devtype='UM4'):
        try:
            conn = psycopg2.connect(dbname='icdata',
                                    user='******',
                                    host='pg10-srv',
                                    password='')
            print("Connected to DB")
        except Exception as err:
            print("No access to DB", err)

        devnames_list = []
        chan_list = []

        cur = conn.cursor()
        cur.execute(
            "select devtype.name, namesys.name || '.' || dev.name as full_name from dev,dev_devtype,devtype, namesys "
            "where dev.id=dev_devtype.dev_id and devtype.id=dev_devtype.devtype_id and namesys.id=dev.namesys_id and "
            "devtype.name in (%(DEVTYPE)s) group by grouping sets((devtype.name, full_name))",
            {'DEVTYPE': devtype})
        for elem in cur.fetchall():
            devnames_list.append(elem[1])
        print('devname_list', devnames_list)

        for key in chans:
            chan_list.append(key)

        for dname in devnames_list:
            name = dname.split('.')[-1]
            print(name, names)
            if name in names:
                for chan_type in chan_list:
                    print(dname + '.' + chan_type)
                    if devtype == 'UM4':
                        chan = cda.DChan(dname + '.' + chan_type)
                    elif devtype == 'ring_bpm_preproc':
                        chan = cda.VChan(dname + '.' + chan_type,
                                         max_nelems=16)
                    else:
                        print('unknown devtype: ', devtype)
                        break
                    chans[chan_type][name] = chan
                    values[chan_type][name] = None
                    chan.valueMeasured.connect(
                        functools.partial(self.chan_val_change, chan, values))
        print(chans)
        return values, chans
Esempio n. 5
0
    def __init__(self, devname, name=None):
        super(MagWalker, self).__init__()
        self.done = cda.InstSignal(str)
        self.progressing = cda.InstSignal(str, int)
        self.started = cda.InstSignal(str)

        self.devname = devname
        self.name = name
        if name is None:
            self.name = devname

        # channels:
        # walker.list - requested list of points to go through
        # walker.start - run process
        # walker.stop - stop running
        # walker.cur_step - current step, -1 when stopped (or finished)
        self.list_chan = cda.VChan(devname + '.walker.list',
                                   dtype=cda.DTYPE_DOUBLE,
                                   max_nelems=20,
                                   on_update=True)
        self.start_chan = cda.DChan(devname + '.walker.start', on_update=True)
        self.stop_chan = cda.DChan(devname + '.walker.stop', on_update=True)
        self.cur_step_chan = cda.DChan(devname + '.walker.cur_step',
                                       on_update=True)
        self.iset_cur_chan = cda.DChan(devname + '.iset_cur', on_update=True)
        self.iset_chan = cda.DChan(devname + '.iset', on_update=True)

        # just for some control
        self.imeas_chan = cda.DChan(devname + '.imes', on_update=True)

        self.initialized = False
        self.cur_list = None
        self.requested_list = None
        self.run_requested = False
        self.running = False
        self.progress = 0
        self.step = -1
        self.step_pos = 0
        self.path_length = 0
        self.start_iset = 0
        self.ext_cur_list = None

        self.list_chan.valueMeasured.connect(self.list_update)
        self.cur_step_chan.valueChanged.connect(self.step_update)
        self.iset_cur_chan.valueChanged.connect(self.iset_cur_update)
Esempio n. 6
0
    def __init__(self, bpm_name='', parent=None):
        super(BPMData, self).__init__(bpm_name, parent)

        if bpm_name == "bpm01":
            bpm_channel = 4
        elif bpm_name == "bpm02":
            bpm_channel = 5
        elif bpm_name == "bpm03":
            bpm_channel = 6
        elif bpm_name == "bpm04":
            bpm_channel = 7
        else:
            bpm_channel = -1

        #self.bpm_name = bpm_name

        bpm_data_name = '{0}{1}{2}'.format(self.bpm_channel_template,
                                           bpm_channel, "@s")
        bpm_numpts_name = '{0}{1}{2}'.format(self.bpm_channel_template,
                                             bpm_channel, "@p10")
        bpm_istart_name = '{0}{1}{2}'.format(
            self.bpm_channel_template, bpm_channel,
            "@p2")  #1 - run mode, 0 - kick mode

        print(bpm_data_name)
        print(bpm_numpts_name)

        self.bpmChan = cda.VChan(bpm_data_name,
                                 max_nelems=8 * 1024 * 4,
                                 dtype=cda.DTYPE_INT32)
        self.bpmChan_numpts = cda.IChan(bpm_numpts_name)
        self.bpmChan_istart = cda.IChan(bpm_istart_name)

        self.bpmChan_numpts.valueMeasured.connect(self._on_numpts_update)
        self.bpmChan_istart.valueMeasured.connect(self._on_istart_update)
        self.bpmChan.valueMeasured.connect(self._on_signal_update)
Esempio n. 7
0
    def __init__(self):
        super(TurnsControl, self).__init__()
        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
        path = os.getcwd()
        conf = re.sub('bpm_plot', 'config', path)
        direc = re.sub('bpm_plot', 'uis', path)
        uic.loadUi(direc + "/plot's.ui", self)
        self.setWindowTitle('Turns Plot')
        self.show()

        self.ic_mode = 'e'
        self.cur_bpm = 'bpm01'
        self.cur_num_pts = 1024
        self.is_single_shot = False
        self.make_turns_shot = False
        self.make_fft_shot = False
        self.make_coor_shot = False

        soft_conf = load_config_orbit(conf + '/orbitd_conf.txt', path)
        chans_conf = soft_conf['chans_conf']
        self.cur_cal = soft_conf['cur_calib']

        for chan in ['turns', 'cmd', 'coor', 'fft', 'modet']:
            if chan not in chans_conf:
                print(chan + ' is absent in orbitd_conf')
                sys.exit(app.exec_())

        # fft and turns
        self.fft_p = FFTPlot(self)
        self.coor_p = CoorPlot(self)
        p0 = QVBoxLayout()
        self.fft_plot_p.setLayout(p0)
        p0.addWidget(self.coor_p)
        p0.addWidget(self.fft_p)

        self.fft_e = FFTPlot(self)
        self.coor_e = CoorPlot(self)
        p1 = QVBoxLayout()
        self.fft_plot_e.setLayout(p1)
        p1.addWidget(self.coor_e)
        p1.addWidget(self.fft_e)

        self.cur_p = CurPlot(self)
        p2 = QVBoxLayout()
        self.turns_mes_plot_p.setLayout(p2)
        p2.addWidget(self.cur_p)

        self.cur_e = CurPlot(self)
        p3 = QVBoxLayout()
        self.turns_mes_plot_e.setLayout(p3)
        p3.addWidget(self.cur_e)

        self.chan_turns = cda.VChan(**chans_conf['turns'])
        self.chan_turns.valueMeasured.connect(self.cur_proc)
        self.chan_fft = cda.VChan(**chans_conf['fft'])
        self.chan_fft.valueMeasured.connect(self.fft_proc)
        self.chan_coor = cda.VChan(**chans_conf['coor'])
        self.chan_coor.valueMeasured.connect(self.coor_proc)
        self.chan_mode = cda.StrChan(**chans_conf['modet'])
        self.chan_mode.valueMeasured.connect(self.mode_proc)
        self.chan_cmd = cda.StrChan(**chans_conf['cmd'])
        self.chan_cmd.valueMeasured.connect(self.cmd)
        # self.chan_res = cda.StrChan(**chans_conf['res'])
        # self.chan_res.valueMeasured.connect(self.cmd_res)

        # boxes changes
        self.btn_shot.clicked.connect(self.shot)
        self.chb_single_shot.stateChanged.connect(self.shot_mode)
        self.btn_save.clicked.connect(self.save)

        self.chan_cmd.setValue(json.dumps({
            'client': 'turns',
            'cmd': 'status'
        }))
Esempio n. 8
0
    def init_chans(self):
        self.chan_adc200_ptsofs_1 = cda.DChan("cxhw:18.adc200_kkr1.ptsofs")
        self.chan_adc200_ptsofs_2 = cda.DChan("cxhw:18.adc200_kkr2.ptsofs")
        self.chan_adc200_numpts_1 = cda.DChan("cxhw:18.adc200_kkr1.numpts")
        self.chan_adc200_numpts_2 = cda.DChan("cxhw:18.adc200_kkr2.numpts")
        self.chan_adc200_timing_1 = cda.DChan("cxhw:18.adc200_kkr1.timing")
        self.chan_adc200_timing_2 = cda.DChan("cxhw:18.adc200_kkr2.timing")
        self.chan_adc200_frq_div_1 = cda.DChan("cxhw:18.adc200_kkr1.frqdiv")
        self.chan_adc200_frq_div_2 = cda.DChan("cxhw:18.adc200_kkr2.frqdiv")
        self.chan_adc200_range_1_1 = cda.DChan("cxhw:18.adc200_kkr1.range1")
        self.chan_adc200_range_1_2 = cda.DChan("cxhw:18.adc200_kkr1.range2")
        self.chan_adc200_range_2_1 = cda.DChan("cxhw:18.adc200_kkr2.range1")
        self.chan_adc200_range_2_2 = cda.DChan("cxhw:18.adc200_kkr2.range2")

        self.chan_pp = cda.VChan("cxhw:18.adc200_kkr1.line1", max_nelems=424)
        self.chan_pn = cda.VChan("cxhw:18.adc200_kkr1.line2", max_nelems=424)
        self.chan_kp = cda.VChan("cxhw:18.adc200_kkr2.line1", max_nelems=424)
        self.chan_kn = cda.VChan("cxhw:18.adc200_kkr2.line2", max_nelems=424)

        self.chan_sel_all = cda.DChan("cxhw:18.kkr_sel_all.0")

        self.cmd_chan = cda.StrChan("cxhw:2.kickADCproc.inj.cmd",
                                    on_update=1,
                                    max_nelems=1024)
        self.res_chan = cda.StrChan("cxhw:2.kickADCproc.inj.res",
                                    on_update=1,
                                    max_nelems=1024)

        self.chan_ic_mode = cda.StrChan("cxhw:0.k500.modet", max_nelems=4)

        self.chan_Tgood_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.Tgood",
            max_nelems=1024)  # positrons "-" prekick
        self.chan_Ugood_ppn = cda.VChan("cxhw:2.inj.prekick.p.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_ppn = cda.VChan("cxhw:2.inj.prekick.p.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_ppn = cda.VChan("cxhw:2.inj.prekick.p.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.delta_a")
        self.chan_delta_t_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.delta_t")
        self.chan_n_interp_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.n_interp")
        self.chan_sigma_t_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.sigma_cur")
        self.chan_delta_arr_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.delta_t_array", max_nelems=100)
        self.chan_t_peak_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.t_peak")
        self.chan_histo_range_ppn = cda.DChan(
            "cxhw:2.inj.prekick.p.neg.histo_range")
        self.chan_histo_x_all_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_3", max_nelems=101)
        self.chan_abs_a_good_ppn = cda.DChan(
            "cxhw:2.inj.prekick.p.neg.abs_a_good")

        self.chan_Tgood_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Tgood",
                                        max_nelems=1024)  # positrons "-" kick
        self.chan_Ugood_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.delta_a")
        self.chan_delta_t_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.delta_t")
        self.chan_n_interp_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.n_interp")
        self.chan_sigma_t_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.sigma_cur")
        self.chan_delta_arr_kpn = cda.VChan(
            "cxhw:2.inj.kick.p.neg.delta_t_array", max_nelems=200)
        self.chan_t_peak_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.t_peak")
        self.chan_histo_x_all_kpn = cda.VChan(
            "cxhw:2.inj.kick.p.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_kpn = cda.VChan(
            "cxhw:2.inj.kick.p.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_y_3",
                                            max_nelems=101)
        self.chan_abs_a_good_kpn = cda.DChan(
            "cxhw:2.inj.kick.p.neg.abs_a_good")

        self.chan_Tgood_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.Tgood",
            max_nelems=1024)  # positrons "+" prekick
        self.chan_Ugood_ppp = cda.VChan("cxhw:2.inj.prekick.p.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_ppp = cda.VChan("cxhw:2.inj.prekick.p.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_ppp = cda.VChan("cxhw:2.inj.prekick.p.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.delta_a")
        self.chan_delta_t_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.delta_t")
        self.chan_n_interp_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.n_interp")
        self.chan_sigma_t_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.sigma_cur")
        self.chan_delta_arr_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.t_peak")
        self.chan_histo_x_all_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_3", max_nelems=101)
        self.chan_abs_a_good_ppp = cda.DChan(
            "cxhw:2.inj.prekick.p.pos.abs_a_good")

        self.chan_Tgood_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Tgood",
                                        max_nelems=1024)  # positrons "+" kick
        self.chan_Ugood_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.delta_a")
        self.chan_delta_t_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.delta_t")
        self.chan_n_interp_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.n_interp")
        self.chan_sigma_t_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.sigma_cur")
        self.chan_delta_arr_kpp = cda.VChan(
            "cxhw:2.inj.kick.p.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.t_peak")
        self.chan_histo_x_all_kpp = cda.VChan(
            "cxhw:2.inj.kick.p.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_kpp = cda.VChan(
            "cxhw:2.inj.kick.p.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_y_3",
                                            max_nelems=101)
        self.chan_abs_a_good_kpp = cda.DChan(
            "cxhw:2.inj.kick.p.pos.abs_a_good")

        self.chan_Tgood_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.Tgood",
            max_nelems=1024)  # electrons "-" prekick
        self.chan_Ugood_pen = cda.VChan("cxhw:2.inj.prekick.e.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_pen = cda.VChan("cxhw:2.inj.prekick.e.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_pen = cda.VChan("cxhw:2.inj.prekick.e.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.delta_a")
        self.chan_delta_t_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.delta_t")
        self.chan_n_interp_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.n_interp")
        self.chan_sigma_t_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.sigma_cur")
        self.chan_delta_arr_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.delta_t_array", max_nelems=200)
        self.chan_t_peak_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.t_peak")
        self.chan_histo_x_all_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_3", max_nelems=101)
        self.chan_abs_a_good_pen = cda.DChan(
            "cxhw:2.inj.prekick.e.neg.abs_a_good")

        self.chan_Tgood_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Tgood",
                                        max_nelems=1024)  # electrons "-" kick
        self.chan_Ugood_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_ken = cda.DChan("cxhw:2.inj.kick.e.neg.delta_a")
        self.chan_delta_t_ken = cda.DChan("cxhw:2.inj.kick.e.neg.delta_t")
        self.chan_n_interp_ken = cda.DChan("cxhw:2.inj.kick.e.neg.n_interp")
        self.chan_sigma_t_ken = cda.DChan("cxhw:2.inj.kick.e.neg.sigma_cur")
        self.chan_delta_arr_ken = cda.VChan(
            "cxhw:2.inj.kick.e.neg.delta_t_array", max_nelems=200)
        self.chan_t_peak_ken = cda.DChan("cxhw:2.inj.kick.e.neg.t_peak")
        self.chan_histo_x_all_ken = cda.VChan(
            "cxhw:2.inj.kick.e.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_ken = cda.VChan(
            "cxhw:2.inj.kick.e.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_y_3",
                                            max_nelems=101)
        self.chan_abs_a_good_ken = cda.DChan(
            "cxhw:2.inj.kick.e.neg.abs_a_good")

        self.chan_Tgood_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.Tgood",
            max_nelems=1024)  # electrons "+" prekick
        self.chan_Ugood_pep = cda.VChan("cxhw:2.inj.prekick.e.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_pep = cda.VChan("cxhw:2.inj.prekick.e.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_pep = cda.VChan("cxhw:2.inj.prekick.e.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.delta_a")
        self.chan_delta_t_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.delta_t")
        self.chan_n_interp_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.n_interp")
        self.chan_sigma_t_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.sigma_cur")
        self.chan_delta_arr_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.t_peak")
        self.chan_histo_x_all_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_3", max_nelems=101)
        self.chan_abs_a_good_pep = cda.DChan(
            "cxhw:2.inj.prekick.e.pos.abs_a_good")

        self.chan_Tgood_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Tgood",
                                        max_nelems=1024)  # electrons "+" kick
        self.chan_Ugood_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_kep = cda.DChan("cxhw:2.inj.kick.e.pos.delta_a")
        self.chan_delta_t_kep = cda.DChan("cxhw:2.inj.kick.e.pos.delta_t")
        self.chan_n_interp_kep = cda.DChan("cxhw:2.inj.kick.e.pos.n_interp")
        self.chan_sigma_t_kep = cda.DChan("cxhw:2.inj.kick.e.pos.sigma_cur")
        self.chan_delta_arr_kep = cda.VChan(
            "cxhw:2.inj.kick.e.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_kep = cda.DChan("cxhw:2.inj.kick.e.pos.t_peak")
        self.chan_histo_x_all_kep = cda.VChan(
            "cxhw:2.inj.kick.e.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_kep = cda.VChan(
            "cxhw:2.inj.kick.e.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_y_3",
                                            max_nelems=101)
        self.chan_abs_a_good_kep = cda.DChan(
            "cxhw:2.inj.kick.e.pos.abs_a_good")

        self.list_hist_ppp = [
            self.chan_histo_x_all_ppp, self.chan_histo_y_all_ppp,
            self.chan_histo_x_1_ppp, self.chan_histo_y_1_ppp,
            self.chan_histo_x_2_ppp, self.chan_histo_y_2_ppp,
            self.chan_histo_x_3_ppp, self.chan_histo_y_3_ppp
        ]
        self.list_hist_ppn = [
            self.chan_histo_x_all_ppn, self.chan_histo_y_all_ppn,
            self.chan_histo_x_1_ppn, self.chan_histo_y_1_ppn,
            self.chan_histo_x_2_ppn, self.chan_histo_y_2_ppn,
            self.chan_histo_x_3_ppn, self.chan_histo_y_3_ppn
        ]
        self.list_hist_kpp = [
            self.chan_histo_x_all_kpp, self.chan_histo_y_all_kpp,
            self.chan_histo_x_1_kpp, self.chan_histo_y_1_kpp,
            self.chan_histo_x_2_kpp, self.chan_histo_y_2_kpp,
            self.chan_histo_x_3_kpp, self.chan_histo_y_3_kpp
        ]
        self.list_hist_kpn = [
            self.chan_histo_x_all_kpn, self.chan_histo_y_all_kpn,
            self.chan_histo_x_1_kpn, self.chan_histo_y_1_kpn,
            self.chan_histo_x_2_kpn, self.chan_histo_y_2_kpn,
            self.chan_histo_x_3_kpn, self.chan_histo_y_3_kpn
        ]
        self.list_hist_pep = [
            self.chan_histo_x_all_pep, self.chan_histo_y_all_pep,
            self.chan_histo_x_1_pep, self.chan_histo_y_1_pep,
            self.chan_histo_x_2_pep, self.chan_histo_y_2_pep,
            self.chan_histo_x_3_ppp, self.chan_histo_y_3_ppp
        ]
        self.list_hist_pen = [
            self.chan_histo_x_all_pen, self.chan_histo_y_all_pen,
            self.chan_histo_x_1_pen, self.chan_histo_y_1_pen,
            self.chan_histo_x_2_pen, self.chan_histo_y_2_pen,
            self.chan_histo_x_3_pen, self.chan_histo_y_3_pen
        ]
        self.list_hist_kep = [
            self.chan_histo_x_all_kep, self.chan_histo_y_all_kep,
            self.chan_histo_x_1_kep, self.chan_histo_y_1_kep,
            self.chan_histo_x_2_kep, self.chan_histo_y_2_kep,
            self.chan_histo_x_3_kep, self.chan_histo_y_3_kep
        ]
        self.list_hist_ken = [
            self.chan_histo_x_all_ken, self.chan_histo_y_all_ken,
            self.chan_histo_x_1_ken, self.chan_histo_y_1_ken,
            self.chan_histo_x_2_ken, self.chan_histo_y_2_ken,
            self.chan_histo_x_3_ken, self.chan_histo_y_3_ken
        ]

        self.dict_hist = {
            'cxhw:18.adc200_kkr1.line1p': self.list_hist_ppp,
            'cxhw:18.adc200_kkr1.line2p': self.list_hist_ppn,
            'cxhw:18.adc200_kkr2.line1p': self.list_hist_kpp,
            'cxhw:18.adc200_kkr2.line2p': self.list_hist_kpn,
            'cxhw:18.adc200_kkr1.line1e': self.list_hist_pep,
            'cxhw:18.adc200_kkr1.line2e': self.list_hist_pen,
            'cxhw:18.adc200_kkr2.line1e': self.list_hist_kep,
            'cxhw:18.adc200_kkr2.line2e': self.list_hist_ken
        }
        self.dict_good_chans = {
            'cxhw:18.adc200_kkr1.line1p': self.chan_Ugood_ppp,
            'cxhw:18.adc200_kkr1.line2p': self.chan_Ugood_ppn,
            'cxhw:18.adc200_kkr2.line1p': self.chan_Ugood_kpp,
            'cxhw:18.adc200_kkr2.line2p': self.chan_Ugood_kpn,
            'cxhw:18.adc200_kkr1.line1e': self.chan_Ugood_pep,
            'cxhw:18.adc200_kkr1.line2e': self.chan_Ugood_pen,
            'cxhw:18.adc200_kkr2.line1e': self.chan_Ugood_kep,
            'cxhw:18.adc200_kkr2.line2e': self.chan_Ugood_ken
        }
        self.dict_temp_chans = {
            'cxhw:18.adc200_kkr1.line1p': self.chan_Utemp_ppp,
            'cxhw:18.adc200_kkr1.line2p': self.chan_Utemp_ppn,
            'cxhw:18.adc200_kkr2.line1p': self.chan_Utemp_kpp,
            'cxhw:18.adc200_kkr2.line2p': self.chan_Utemp_kpn,
            'cxhw:18.adc200_kkr1.line1e': self.chan_Utemp_pep,
            'cxhw:18.adc200_kkr1.line2e': self.chan_Utemp_pen,
            'cxhw:18.adc200_kkr2.line1e': self.chan_Utemp_kep,
            'cxhw:18.adc200_kkr2.line2e': self.chan_Utemp_ken
        }
        self.dict_delta_t = {
            'cxhw:18.adc200_kkr1.line1p': self.chan_delta_t_ppp,
            'cxhw:18.adc200_kkr1.line2p': self.chan_delta_t_ppn,
            'cxhw:18.adc200_kkr2.line1p': self.chan_delta_t_kpp,
            'cxhw:18.adc200_kkr2.line2p': self.chan_delta_t_kpn,
            'cxhw:18.adc200_kkr1.line1e': self.chan_delta_t_pep,
            'cxhw:18.adc200_kkr1.line2e': self.chan_delta_t_pen,
            'cxhw:18.adc200_kkr2.line1e': self.chan_delta_t_kep,
            'cxhw:18.adc200_kkr2.line2e': self.chan_delta_t_ken
        }
        self.dict_delta_arr = {
            'cxhw:18.adc200_kkr1.line1p': self.chan_delta_arr_ppp,
            'cxhw:18.adc200_kkr1.line2p': self.chan_delta_arr_ppn,
            'cxhw:18.adc200_kkr2.line1p': self.chan_delta_arr_kpp,
            'cxhw:18.adc200_kkr2.line2p': self.chan_delta_arr_kpn,
            'cxhw:18.adc200_kkr1.line1e': self.chan_delta_arr_pep,
            'cxhw:18.adc200_kkr1.line2e': self.chan_delta_arr_pen,
            'cxhw:18.adc200_kkr2.line1e': self.chan_delta_arr_kep,
            'cxhw:18.adc200_kkr2.line2e': self.chan_delta_arr_ken
        }
        self.dict_sigma_t = {
            'cxhw:18.adc200_kkr1.line1p': self.chan_sigma_t_ppp,
            'cxhw:18.adc200_kkr1.line2p': self.chan_sigma_t_ppn,
            'cxhw:18.adc200_kkr2.line1p': self.chan_sigma_t_kpp,
            'cxhw:18.adc200_kkr2.line2p': self.chan_sigma_t_kpn,
            'cxhw:18.adc200_kkr1.line1e': self.chan_sigma_t_pep,
            'cxhw:18.adc200_kkr1.line2e': self.chan_sigma_t_pen,
            'cxhw:18.adc200_kkr2.line1e': self.chan_sigma_t_kep,
            'cxhw:18.adc200_kkr2.line2e': self.chan_sigma_t_ken
        }
        self.dict_t_peak = {
            'cxhw:18.adc200_kkr1.line1p': self.chan_t_peak_ppp,
            'cxhw:18.adc200_kkr1.line2p': self.chan_t_peak_ppn,
            'cxhw:18.adc200_kkr2.line1p': self.chan_t_peak_kpp,
            'cxhw:18.adc200_kkr2.line2p': self.chan_t_peak_kpn,
            'cxhw:18.adc200_kkr1.line1e': self.chan_t_peak_pep,
            'cxhw:18.adc200_kkr1.line2e': self.chan_t_peak_pen,
            'cxhw:18.adc200_kkr2.line1e': self.chan_t_peak_kep,
            'cxhw:18.adc200_kkr2.line2e': self.chan_t_peak_ken
        }
Esempio n. 9
0
    def init_chans(self):
        self.chan_sel_all = cda.DChan("cxhw:18.kkr_sel_all.0")

        self.cmd_chan = cda.StrChan("cxhw:2.kickADCproc.inj.cmd@u")
        self.res_chan = cda.StrChan("cxhw:2.kickADCproc.inj.res@u")

        self.chan_ic_mode = cda.StrChan("cxhw:0.k500.modet", max_nelems=4)

        self.chan_Tgood_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.Tgood",
            max_nelems=1024)  # positrons "-" prekick
        self.chan_Ugood_ppn = cda.VChan("cxhw:2.inj.prekick.p.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_ppn = cda.VChan("cxhw:2.inj.prekick.p.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_ppn = cda.VChan("cxhw:2.inj.prekick.p.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.delta_a")
        self.chan_delta_t_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.delta_t")
        self.chan_n_interp_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.n_interp")
        self.chan_sigma_t_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.sigma_cur")
        self.chan_delta_arr_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.delta_t_array", max_nelems=100)
        self.chan_t_peak_ppn = cda.DChan("cxhw:2.inj.prekick.p.neg.t_peak")
        self.chan_histo_range_ppn = cda.DChan(
            "cxhw:2.inj.prekick.p.neg.histo_range")
        self.chan_histo_x_all_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_ppn = cda.VChan(
            "cxhw:2.inj.prekick.p.neg.histo_y_3", max_nelems=101)

        self.chan_Tgood_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Tgood",
                                        max_nelems=1024)  # positrons "-" kick
        self.chan_Ugood_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.delta_a")
        self.chan_delta_t_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.delta_t")
        self.chan_n_interp_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.n_interp")
        self.chan_sigma_t_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.sigma_cur")
        self.chan_delta_arr_kpn = cda.VChan(
            "cxhw:2.inj.kick.p.neg.delta_t_array", max_nelems=200)
        self.chan_t_peak_kpn = cda.DChan("cxhw:2.inj.kick.p.neg.t_peak")
        self.chan_histo_x_all_kpn = cda.VChan(
            "cxhw:2.inj.kick.p.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_kpn = cda.VChan(
            "cxhw:2.inj.kick.p.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_kpn = cda.VChan("cxhw:2.inj.kick.p.neg.histo_y_3",
                                            max_nelems=101)

        self.chan_Tgood_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.Tgood",
            max_nelems=1024)  # positrons "+" prekick
        self.chan_Ugood_ppp = cda.VChan("cxhw:2.inj.prekick.p.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_ppp = cda.VChan("cxhw:2.inj.prekick.p.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_ppp = cda.VChan("cxhw:2.inj.prekick.p.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.delta_a")
        self.chan_delta_t_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.delta_t")
        self.chan_n_interp_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.n_interp")
        self.chan_sigma_t_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.sigma_cur")
        self.chan_delta_arr_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_ppp = cda.DChan("cxhw:2.inj.prekick.p.pos.t_peak")
        self.chan_histo_x_all_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_ppp = cda.VChan(
            "cxhw:2.inj.prekick.p.pos.histo_y_3", max_nelems=101)

        self.chan_Tgood_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Tgood",
                                        max_nelems=1024)  # positrons "+" kick
        self.chan_Ugood_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.delta_a")
        self.chan_delta_t_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.delta_t")
        self.chan_n_interp_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.n_interp")
        self.chan_sigma_t_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.sigma_cur")
        self.chan_delta_arr_kpp = cda.VChan(
            "cxhw:2.inj.kick.p.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_kpp = cda.DChan("cxhw:2.inj.kick.p.pos.t_peak")
        self.chan_histo_x_all_kpp = cda.VChan(
            "cxhw:2.inj.kick.p.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_kpp = cda.VChan(
            "cxhw:2.inj.kick.p.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_kpp = cda.VChan("cxhw:2.inj.kick.p.pos.histo_y_3",
                                            max_nelems=101)

        self.chan_Tgood_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.Tgood",
            max_nelems=1024)  # electrons "-" prekick
        self.chan_Ugood_pen = cda.VChan("cxhw:2.inj.prekick.e.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_pen = cda.VChan("cxhw:2.inj.prekick.e.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_pen = cda.VChan("cxhw:2.inj.prekick.e.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.delta_a")
        self.chan_delta_t_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.delta_t")
        self.chan_n_interp_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.n_interp")
        self.chan_sigma_t_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.sigma_cur")
        self.chan_delta_arr_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.delta_t_array", max_nelems=200)
        self.chan_t_peak_pen = cda.DChan("cxhw:2.inj.prekick.e.neg.t_peak")
        self.chan_histo_x_all_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_pen = cda.VChan(
            "cxhw:2.inj.prekick.e.neg.histo_y_3", max_nelems=101)

        self.chan_Tgood_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Tgood",
                                        max_nelems=1024)  # electrons "-" kick
        self.chan_Ugood_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_ken = cda.VChan("cxhw:2.inj.kick.e.neg.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_ken = cda.DChan("cxhw:2.inj.kick.e.neg.delta_a")
        self.chan_delta_t_ken = cda.DChan("cxhw:2.inj.kick.e.neg.delta_t")
        self.chan_n_interp_ken = cda.DChan("cxhw:2.inj.kick.e.neg.n_interp")
        self.chan_sigma_t_ken = cda.DChan("cxhw:2.inj.kick.e.neg.sigma_cur")
        self.chan_delta_arr_ken = cda.VChan(
            "cxhw:2.inj.kick.e.neg.delta_t_array", max_nelems=200)
        self.chan_t_peak_ken = cda.DChan("cxhw:2.inj.kick.e.neg.t_peak")
        self.chan_histo_x_all_ken = cda.VChan(
            "cxhw:2.inj.kick.e.neg.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_ken = cda.VChan(
            "cxhw:2.inj.kick.e.neg.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_ken = cda.VChan("cxhw:2.inj.kick.e.neg.histo_y_3",
                                            max_nelems=101)

        self.chan_Tgood_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.Tgood",
            max_nelems=1024)  # electrons "+" prekick
        self.chan_Ugood_pep = cda.VChan("cxhw:2.inj.prekick.e.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_pep = cda.VChan("cxhw:2.inj.prekick.e.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_pep = cda.VChan("cxhw:2.inj.prekick.e.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.delta_a")
        self.chan_delta_t_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.delta_t")
        self.chan_n_interp_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.n_interp")
        self.chan_sigma_t_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.sigma_cur")
        self.chan_delta_arr_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_pep = cda.DChan("cxhw:2.inj.prekick.e.pos.t_peak")
        self.chan_histo_x_all_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_1", max_nelems=101)
        self.chan_histo_y_1_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_1", max_nelems=101)
        self.chan_histo_x_2_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_2", max_nelems=101)
        self.chan_histo_y_2_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_2", max_nelems=101)
        self.chan_histo_x_3_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_x_3", max_nelems=101)
        self.chan_histo_y_3_pep = cda.VChan(
            "cxhw:2.inj.prekick.e.pos.histo_y_3", max_nelems=101)

        self.chan_Tgood_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Tgood",
                                        max_nelems=1024)  # electrons "+" kick
        self.chan_Ugood_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Ugood",
                                        max_nelems=1024)
        self.chan_Ttemp_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Ttemp",
                                        max_nelems=1024)
        self.chan_Utemp_kep = cda.VChan("cxhw:2.inj.kick.e.pos.Utemp",
                                        max_nelems=1024)
        self.chan_delta_a_kep = cda.DChan("cxhw:2.inj.kick.e.pos.delta_a")
        self.chan_delta_t_kep = cda.DChan("cxhw:2.inj.kick.e.pos.delta_t")
        self.chan_n_interp_kep = cda.DChan("cxhw:2.inj.kick.e.pos.n_interp")
        self.chan_sigma_t_kep = cda.DChan("cxhw:2.inj.kick.e.pos.sigma_cur")
        self.chan_delta_arr_kep = cda.VChan(
            "cxhw:2.inj.kick.e.pos.delta_t_array", max_nelems=200)
        self.chan_t_peak_kep = cda.DChan("cxhw:2.inj.kick.e.pos.t_peak")
        self.chan_histo_x_all_kep = cda.VChan(
            "cxhw:2.inj.kick.e.pos.histo_x_all", max_nelems=100)
        self.chan_histo_y_all_kep = cda.VChan(
            "cxhw:2.inj.kick.e.pos.histo_y_all", max_nelems=100)
        self.chan_histo_x_1_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_x_1",
                                            max_nelems=101)
        self.chan_histo_y_1_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_y_1",
                                            max_nelems=101)
        self.chan_histo_x_2_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_x_2",
                                            max_nelems=101)
        self.chan_histo_y_2_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_y_2",
                                            max_nelems=101)
        self.chan_histo_x_3_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_x_3",
                                            max_nelems=101)
        self.chan_histo_y_3_kep = cda.VChan("cxhw:2.inj.kick.e.pos.histo_y_3",
                                            max_nelems=101)

        self.dict_count = {
            'cxhw:2.inj.prekick.p.neg.Utemp': 0,
            'cxhw:2.inj.kick.p.neg.Utemp': 0,
            'cxhw:2.inj.prekick.p.pos.Utemp': 0,
            'cxhw:2.inj.kick.p.pos.Utemp': 0,
            'cxhw:2.inj.prekick.e.neg.Utemp': 0,
            'cxhw:2.inj.kick.e.neg.Utemp': 0,
            'cxhw:2.inj.prekick.e.pos.Utemp': 0,
            'cxhw:2.inj.kick.e.pos.Utemp': 0
        }

        self.dict_delta_t = {
            'cxhw:2.inj.prekick.p.pos.Utemp': self.chan_delta_t_ppp,
            'cxhw:2.inj.prekick.p.neg.Utemp': self.chan_delta_t_ppn,
            'cxhw:2.inj.kick.p.pos.Utemp': self.chan_delta_t_kpp,
            'cxhw:2.inj.kick.p.neg.Utemp': self.chan_delta_t_kpn,
            'cxhw:2.inj.prekick.e.pos.Utemp': self.chan_delta_t_pep,
            'cxhw:2.inj.prekick.e.neg.Utemp': self.chan_delta_t_pen,
            'cxhw:2.inj.kick.e.pos.Utemp': self.chan_delta_t_kep,
            'cxhw:2.inj.kick.e.neg.Utemp': self.chan_delta_t_ken
        }

        self.dict_sigma_t = {
            'cxhw:2.inj.prekick.p.pos.Utemp': self.chan_sigma_t_ppp,
            'cxhw:2.inj.prekick.p.neg.Utemp': self.chan_sigma_t_ppn,
            'cxhw:2.inj.kick.p.pos.Utemp': self.chan_sigma_t_kpp,
            'cxhw:2.inj.kick.p.neg.Utemp': self.chan_sigma_t_kpn,
            'cxhw:2.inj.prekick.e.pos.Utemp': self.chan_sigma_t_pep,
            'cxhw:2.inj.prekick.e.neg.Utemp': self.chan_sigma_t_pen,
            'cxhw:2.inj.kick.e.pos.Utemp': self.chan_sigma_t_kep,
            'cxhw:2.inj.kick.e.neg.Utemp': self.chan_sigma_t_ken
        }

        self.dict_good_chans = {
            'cxhw:2.inj.prekick.p.pos.Utemp': self.chan_Ugood_ppp,
            'cxhw:2.inj.prekick.p.neg.Utemp': self.chan_Ugood_ppn,
            'cxhw:2.inj.kick.p.pos.Utemp': self.chan_Ugood_kpp,
            'cxhw:2.inj.kick.p.neg.Utemp': self.chan_Ugood_kpn,
            'cxhw:2.inj.prekick.e.pos.Utemp': self.chan_Ugood_pep,
            'cxhw:2.inj.prekick.e.neg.Utemp': self.chan_Ugood_pen,
            'cxhw:2.inj.kick.e.pos.Utemp': self.chan_Ugood_kep,
            'cxhw:2.inj.kick.e.neg.Utemp': self.chan_Ugood_ken
        }

        self.dict_temp_chans = {
            'cxhw:2.inj.prekick.p.pos.Utemp': self.chan_Utemp_ppp,
            'cxhw:2.inj.prekick.p.neg.Utemp': self.chan_Utemp_ppn,
            'cxhw:2.inj.kick.p.pos.Utemp': self.chan_Utemp_kpp,
            'cxhw:2.inj.kick.p.neg.Utemp': self.chan_Utemp_kpn,
            'cxhw:2.inj.prekick.e.pos.Utemp': self.chan_Utemp_pep,
            'cxhw:2.inj.prekick.e.neg.Utemp': self.chan_Utemp_pen,
            'cxhw:2.inj.kick.e.pos.Utemp': self.chan_Utemp_kep,
            'cxhw:2.inj.kick.e.neg.Utemp': self.chan_Utemp_ken
        }

        self.list_hist_ppp = [
            self.chan_histo_x_all_ppp, self.chan_histo_y_all_ppp,
            self.chan_histo_x_1_ppp, self.chan_histo_y_1_ppp,
            self.chan_histo_x_2_ppp, self.chan_histo_y_2_ppp,
            self.chan_histo_x_3_ppp, self.chan_histo_y_3_ppp
        ]
        self.list_hist_ppn = [
            self.chan_histo_x_all_ppn, self.chan_histo_y_all_ppn,
            self.chan_histo_x_1_ppn, self.chan_histo_y_1_ppn,
            self.chan_histo_x_2_ppn, self.chan_histo_y_2_ppn,
            self.chan_histo_x_3_ppn, self.chan_histo_y_3_ppn
        ]
        self.list_hist_kpp = [
            self.chan_histo_x_all_kpp, self.chan_histo_y_all_kpp,
            self.chan_histo_x_1_kpp, self.chan_histo_y_1_kpp,
            self.chan_histo_x_2_kpp, self.chan_histo_y_2_kpp,
            self.chan_histo_x_3_kpp, self.chan_histo_y_3_kpp
        ]
        self.list_hist_kpn = [
            self.chan_histo_x_all_kpn, self.chan_histo_y_all_kpn,
            self.chan_histo_x_1_kpn, self.chan_histo_y_1_kpn,
            self.chan_histo_x_2_kpn, self.chan_histo_y_2_kpn,
            self.chan_histo_x_3_kpn, self.chan_histo_y_3_kpn
        ]
        self.list_hist_pep = [
            self.chan_histo_x_all_pep, self.chan_histo_y_all_pep,
            self.chan_histo_x_1_pep, self.chan_histo_y_1_pep,
            self.chan_histo_x_2_pep, self.chan_histo_y_2_pep,
            self.chan_histo_x_3_ppp, self.chan_histo_y_3_ppp
        ]
        self.list_hist_pen = [
            self.chan_histo_x_all_pen, self.chan_histo_y_all_pen,
            self.chan_histo_x_1_pen, self.chan_histo_y_1_pen,
            self.chan_histo_x_2_pen, self.chan_histo_y_2_pen,
            self.chan_histo_x_3_pen, self.chan_histo_y_3_pen
        ]
        self.list_hist_kep = [
            self.chan_histo_x_all_kep, self.chan_histo_y_all_kep,
            self.chan_histo_x_1_kep, self.chan_histo_y_1_kep,
            self.chan_histo_x_2_kep, self.chan_histo_y_2_kep,
            self.chan_histo_x_3_kep, self.chan_histo_y_3_kep
        ]
        self.list_hist_ken = [
            self.chan_histo_x_all_ken, self.chan_histo_y_all_ken,
            self.chan_histo_x_1_ken, self.chan_histo_y_1_ken,
            self.chan_histo_x_2_ken, self.chan_histo_y_2_ken,
            self.chan_histo_x_3_ken, self.chan_histo_y_3_ken
        ]

        self.dict_hist = {
            'cxhw:2.inj.prekick.p.pos.Utemp': self.list_hist_ppp,
            'cxhw:2.inj.prekick.p.neg.Utemp': self.list_hist_ppn,
            'cxhw:2.inj.kick.p.pos.Utemp': self.list_hist_kpp,
            'cxhw:2.inj.kick.p.neg.Utemp': self.list_hist_kpn,
            'cxhw:2.inj.prekick.e.pos.Utemp': self.list_hist_pep,
            'cxhw:2.inj.prekick.e.neg.Utemp': self.list_hist_pen,
            'cxhw:2.inj.kick.e.pos.Utemp': self.list_hist_kep,
            'cxhw:2.inj.kick.e.neg.Utemp': self.list_hist_ken
        }
Esempio n. 10
0
    def __init__(self):
        super(PlotControl, self).__init__()
        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
        path = os.getcwd()
        conf = re.sub('bpm_plot', 'config', path)
        direc = re.sub('bpm_plot', 'uis', path)
        uic.loadUi(direc + "/bpm's.ui", self)
        self.setWindowTitle('Orbit Plot')
        self.show()

        soft_conf = load_config_orbit(conf + '/orbitd_conf.txt', path)
        chans_conf = soft_conf['chans_conf']
        self.bpms = soft_conf['bpm_conf']
        self.bpm_coor = soft_conf['bpm_coor']

        for chan in [
                'act_bpm', 'cmd', 'res', 'orbit', 'control_orbit', 'modet'
        ]:
            if chan not in chans_conf:
                print(chan + ' is absent in orbitd_conf')
                sys.exit(app.exec_())

        self.orbit_plots: dict = {
            'x_orbit':
            OrbitPlot('x',
                      conf + '/x_aper.txt',
                      self.bpms,
                      self.bpm_coor,
                      parent=self),
            'z_orbit':
            OrbitPlot('z',
                      conf + '/z_aper.txt',
                      self.bpms,
                      self.bpm_coor,
                      parent=self)
        }

        # variables for under control objects init
        self.ic_mode: str
        self.cur_orbit: nparray = np.zeros(2 * len(self.bpms))
        self.cur_bpms: list = self.bpms.copy()

        # migrate to special bpm tuning window
        p = QVBoxLayout()
        self.plot_coor.setLayout(p)
        for o_type, plot in self.orbit_plots.items():
            p.addWidget(plot)

        self.btn_dict: dict = {
            'e2v4': self.btn_sel_e2v4,
            'p2v4': self.btn_sel_p2v4,
            'e2v2': self.btn_sel_e2v2,
            'p2v2': self.btn_sel_p2v2
        }
        for key, btn in self.btn_dict.items():
            btn.clicked.connect(self.load_file_)

        self.colors: dict = {
            'e2v4': 'background-color:#55ffff;',
            'p2v4': 'background-color:#ff86ff;',
            'e2v2': 'background-color:#75ff91;',
            'p2v2': 'background-color:#ff6b6b;'
        }
        self.inj_mode_matr: dict = {'p': False, 'e': False}

        # self.btn_bot_on.clicked.connect(self.bot_ctrl)
        # self.btn_bot_off.clicked.connect(self.bot_ctrl)

        # action btn ctrl
        self.btn_bckgr_discard.clicked.connect(self.bckrg_discard)
        self.btn_save.clicked.connect(self.save_file_)
        self.btn_bckgr.clicked.connect(self.bckgr)
        self.btn_step_up.clicked.connect(self.step_up)
        self.btn_step_dn.clicked.connect(self.step_down)
        self.btn_load_rrm.clicked.connect(self.load_resp_mat)
        self.btn_reknob.clicked.connect(self.knob_recalc)

        # other ordinary channels
        self.chan_mode = cda.StrChan(**chans_conf['modet'])
        self.chan_mode.valueMeasured.connect(self.mode_changed)
        self.chan_cmd = cda.StrChan(**chans_conf['cmd'])
        self.chan_res = cda.StrChan(**chans_conf['res'])
        self.chan_res.valueMeasured.connect(self.cmd_res)

        # data chans
        self.chan_orbit = cda.VChan(**chans_conf['orbit'])
        self.chan_orbit.valueMeasured.connect(self.new_orbit)
        self.chan_ctrl_orbit = cda.VChan(**chans_conf['control_orbit'])
        self.chan_ctrl_orbit.valueMeasured.connect(self.new_ctrl_orbit)
        self.chan_act_bpm = cda.StrChan(**chans_conf['act_bpm'])
        self.chan_act_bpm.valueMeasured.connect(self.new_act_bpm)
Esempio n. 11
0
    def __init__(self):
        super(TunesControl, self).__init__()
        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
        path = os.getcwd()
        conf = re.sub('bpm_plot', 'config', path)
        direc = re.sub('bpm_plot', 'uis', path)
        uic.loadUi(direc + "/wp's.ui", self)
        self.setWindowTitle('Tunes Plot')
        self.show()

        self.ic_mode = ''
        self.cur_tunes = np.zeros(2)
        self.dir = os.getcwd()

        self.tunes_plot = pg.PlotWidget()
        p = QVBoxLayout()
        self.wp_plot.setLayout(p)
        p.addWidget(self.tunes_plot)

        # res_diag tune properties set
        self.tunes_plot.setRange(yRange=[0, 1])
        self.tunes_plot.setRange(xRange=[0, 1])
        self.tunes_plot.addItem(LinesPlot(Converter.res_diag(4), order=4, color=QtGui.QColor('#852EBA')))
        self.tunes_plot.addItem(LinesPlot(Converter.res_diag(3), order=3, color=QtGui.QColor('#B5FBDD')))
        self.tunes_plot.addItem(LinesPlot(Converter.res_diag(2), order=2, color=QtGui.QColor('#FFA96B')))
        self.tunes_plot.addItem(LinesPlot(Converter.res_diag(1), order=1, color=QtCore.Qt.black))
        self.tunes = {'e2v4': TunesMarker(color=QtGui.QColor('#55ffff')),
                      'p2v4': TunesMarker(color=QtGui.QColor('#ff86ff')),
                      'e2v2': TunesMarker(color=QtGui.QColor('#75ff91')),
                      'p2v2': TunesMarker(color=QtGui.QColor('#ff6b6b')),
                      'cur': TunesMarker(color=QtGui.QColor('#808285'))}
        for t_type, tune_marker in self.tunes.items():
            self.tunes_plot.addItem(tune_marker)
        self.legend = pg.LegendItem()
        self.legend.setParentItem(self.tunes_plot.getPlotItem())

        self.btn_dict = {'e2v4': self.btn_sel_e2v4, 'p2v4': self.btn_sel_p2v4, 'e2v2': self.btn_sel_e2v2,
                         'p2v2': self.btn_sel_p2v2}
        for key, btn in self.btn_dict.items():
            btn.clicked.connect(self.load_file_)
        self.btn_save.clicked.connect(self.save_file_)
        self.colors = {'e2v4': 'background-color:#55ffff;', 'p2v4': 'background-color:#ff86ff;',
                       'e2v2': 'background-color:#75ff91;', 'p2v2': 'background-color:#ff6b6b;'}
        self.lbl_dict = {'e2v4': self.lbl_e2v4, 'p2v4': self.lbl_p2v4, 'e2v2': self.lbl_e2v2, 'p2v2': self.lbl_p2v2,
                         'cur': self.lbl_cur}

        soft_conf = load_config_orbit(conf + '/orbitd_conf.txt', path)
        chans_conf = soft_conf['chans_conf']

        for chan in ['tunes', 'cmd', 'res', 'control_tunes', 'modet']:
            if chan not in chans_conf:
                print(chan + ' is absent in orbitd_conf')
                sys.exit(app.exec_())

        self.chan_mode = cda.StrChan(**chans_conf['modet'])
        self.chan_mode.valueMeasured.connect(self.mode_changed)
        self.chan_tunes = cda.VChan(**chans_conf['tunes'])
        self.chan_tunes.valueMeasured.connect(self.tunes_update)
        self.chan_ctrl_tunes = cda.StrChan(**chans_conf['control_tunes'])
        self.chan_ctrl_tunes.valueMeasured.connect(self.ctrl_tunes_update)
        self.chan_cmd = cda.StrChan(**chans_conf['cmd'])
        self.chan_res = cda.StrChan(**chans_conf['res'])
        self.chan_res.valueMeasured.connect(self.cmd_result)
        # put IC mode tunes into their place on res_diag
        self.chan_cmd.setValue((json.dumps({'cmd': 'start_tunes', 'client': 'tunes'})))
Esempio n. 12
0
    def __init__(self):
        super(InjTune, self).__init__()
        path = os.getcwd()
        direc = re.sub('knobs', 'uis', path)
        conf = re.sub('knobs', 'config', path)
        self.p_win = uic.loadUi(direc + "/inj_vs_tune.ui")
        self.setWindowTitle('InjResp')
        self.p_win.show()

        soft_conf = load_config_knob(conf + '/knobd_conf.txt')
        chan_conf = soft_conf['chans_conf']
        for chan in [
                'res', 'cmd', 'tunes', 'extractioncurrent', 'eshots', 'pshots',
                'modet', 'extracted'
        ]:
            if chan not in chan_conf:
                print(chan + ' is absent in knobd_conf')
                sys.exit(app.exec_())

        self.chan_cmd = cda.StrChan(**chan_conf['cmd'])
        self.chan_res = cda.StrChan(**chan_conf['res'])
        self.chan_res.valueMeasured.connect(self.res)
        self.chan_tunes = cda.VChan(**chan_conf['tunes'])
        self.chan_tunes.valueMeasured.connect(self.tunes_changed)
        self.chan_extracted = cda.DChan(**chan_conf['extractioncurrent'])
        self.chan_extracted.valueMeasured.connect(self.extracted_current)
        self.chan_eshots = cda.DChan(**chan_conf['eshots'])
        self.chan_eshots.valueMeasured.connect(self.shots_num)
        self.chan_pshots = cda.DChan(**chan_conf['pshots'])
        self.chan_pshots.valueMeasured.connect(self.shots_num)
        self.chan_modet = cda.StrChan(**chan_conf['modet'])
        self.chan_modet.valueMeasured.connect(self.modet)
        self.chan_modet = cda.DChan(**chan_conf['extracted'])
        self.chan_modet.valueMeasured.connect(self.extraction)

        self.p_win.handles_table.cellPressed.connect(self.index)
        self.handle_1: object = BtnHandle(self.p_win.btn_handle_1, 'Handle #1',
                                          'Handle #2')
        self.p_win.btn_handle_1.clicked.connect(
            partial(self.hand_choosed, self.handle_1))
        self.handle_2: object = BtnHandle(self.p_win.btn_handle_2, 'Handle #2',
                                          'Handle #1')
        self.p_win.btn_handle_2.clicked.connect(
            partial(self.hand_choosed, self.handle_2))
        self.p_win.btn_start.clicked.connect(self.start)

        #########################
        self.shift: function = None  # tune shift func
        self.handle: object = None
        ##########################
        self.extraction_flag: bool = False
        self.cur_flag: bool = False
        self.tunes_flag: bool = False
        self.shots_skip: dict = {'p': 10, 'e': 2}
        ##########################
        self.marked_row: int = None
        self.cross_booked: dict = {'Handle #1': None, 'Handle #2': None}
        ##########################
        self.mode: str = 'e'
        self.cur_tunes: list = [0.0, 0.0]
        self.ring_cur_arr: list = []
        self.ring_cur_data: dict = {}
        ##########################
        self.skip_counter: int = 0
        self.counter: int = 0
        self.n_amount: int = 36
        self.shots_counter: int = 1
        self.n_mesh: int = 1
        self.n_shots: int = 3
        self.cur_1_it: int = 0
        self.cur_2_it: int = 0
        ##########################
        self.load_handles()
Esempio n. 13
0
 def __init__(self):
     super(Test, self).__init__()
     self.data = np.linspace(1, 100, 100)
     self.chan_fft = cda.VChan('cxhw:4.bpm_preproc.fft', max_nelems=262144)
     self.chan_fft.valueMeasured.connect(self.chan_callback)
     QTimer.singleShot(3000, self.chan_write)