예제 #1
0
    def __init__(self, bpm, collect_orbit, chan_tunes, chan_turns, chan_fft, chan_coor, collect_act_bpm, CONF):
        super(BPM, self).__init__()
        self.collect_orbit, self.chan_tunes, self.chan_turns, self.chan_fft, self.chan_coor, self.collect_act_bpm = \
            collect_orbit, chan_tunes, chan_turns, chan_fft, chan_coor, collect_act_bpm

        chans_conf = load_config_bpm(CONF + '/bpm_conf.txt', bpm)
        for chan in ['datatxzi', 'numpts', 'tunes_range', 'is_on', 'x', 'xstd', 'z', 'zstd']:
            if chan not in chans_conf:
                print(bpm + ' ' + chan + ' is absent in bpm_conf')

        self.chan_is_on = cda.DChan(**chans_conf['is_on'])
        self.chan_is_on.valueMeasured.connect(self.is_on)
        self.chan_x = cda.DChan(**chans_conf['x'])
        self.chan_xstd = cda.DChan(**chans_conf['xstd'])
        self.chan_z = cda.DChan(**chans_conf['z'])
        self.chan_zstd = cda.DChan(**chans_conf['zstd'])
        self.chan_tunes_range = cda.StrChan(**chans_conf['tunes_range'])
        self.chan_tunes_range.valueMeasured.connect(self.tunes_range)
        self.chan_datatxzi = cda.VChan(**chans_conf['datatxzi'])
        self.chan_datatxzi.valueMeasured.connect(self.data_proc)

        self.name: str = bpm
        self.turns_mes: int = 0
        self.act_state: int = 1
        self.data_len: int = 1024
        self.coor: tuple = (0.0, 0.0)
        self.std: tuple = (0.0, 0.0)
        self.x_bound: list = [0.345, 0.365]
        self.z_bound: list = [0.2, 0.4]
        self.marker = 1
예제 #2
0
 def add_cor_(self, **kwargs):
     cor = kwargs.get('cor')
     knob_id = kwargs.get('knob_id')
     row = self.row_by_id(knob_id)
     if row != -404:
         self.handle_descr[row]['cor_list'].append(cor)
         if cor['name'].split('.')[-1][0] == 'G':
             channel = cda.DChan(cor['name'] + '.Uset', private=1)
         else:
             channel = cda.DChan(cor['name'] + '.Iset', private=1)
         self.handles[row][cor['name'].split('.')[-1]] = [channel, cor['step']]
예제 #3
0
 def load_handle_(self, knob):
     handle_params = {}
     self.handles_renum()
     self.handle_descr[0] = knob
     for cor in knob['cor_list']:
         if cor['name'].split('.')[-1][0] == 'G':
             handle_params[cor['name'].split('.')[-1]] = [cda.DChan(cor['name'] + '.Uset', private=1), cor['step']]
         else:
             handle_params[cor['name'].split('.')[-1]] = [cda.DChan(cor['name'] + '.Iset', private=1), cor['step']]
     self.handles[0] = handle_params
     self.save_changes()
     self.chan_res.setValue(json.dumps({'client': 'handle', 'res': 'handles_loaded'}))
     self.chan_cmd.setValue('')
예제 #4
0
 def __init__(self):
     # registering chans
     self.c_drm_set = cda.DChan("canhw:12.dRM.Iset")
     self.c_crm_set = [
         cda.DChan("canhw:12.rst2.cRM" + str(x + 1) + ".Iset")
         for x in range(8)
     ]
     self.c_eset = cda.DChan("cxhw:0.info.Emag")
     self.c_drm_set.valueChanged.connect(self.update_energy)
     for x in self.c_crm_set:
         x.valueChanged.connect(self.update_energy)
     self.H = np.zeros(8)
     self.Hmean = 0
     self.Eset = 0
예제 #5
0
    def __init__(self):
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.file_ev = cda.FdEvent(self.sock)
        self.file_ev.ready.connect(self.recive_pack)
        self.pack_count = 0

        self.chans = {ln+1: {sn+1: cda.DChan("{srv}.wg{wgn}.temp{sensn}".format(srv=cx_srv, wgn=ln+1, sensn=sn+1))
                      for sn in range(3)} for ln in range(4)}
        self.chans[5] = {1: cda.DChan("{srv}.kls_hall.t".format(srv=cx_srv))}
        self.ids = {}

        self.timer = cda.Timer()
        self.timer.timeout.connect(self.request_data)

        self.request_data()
예제 #6
0
    def __init__(self, bpm, collect_orbit, collect_tunes, send_current,
                 send_fft, send_coor, CONF):
        super(BPM, self).__init__()
        self.collect_orbit, self.collect_tunes, self.send_current, self.send_fft, self.send_coor = \
            collect_orbit, collect_tunes, send_current, send_fft, send_coor

        chans_conf = load_config_bpm(CONF + '/bpm_conf.txt', bpm)
        for chan in ['datatxzi', 'numpts', 'tunes_range']:
            if chan not in chans_conf:
                print(bpm + ' ' + chan + ' is absent in bpm_conf')

        self.last_data_upd: int = 0
        self.no_connection: bool = False
        self.name: str = bpm
        self.turns_mes: int = 0
        self.act_state: int = 1
        self.marker: int = 0
        self.turn_num: int = 1
        self.data_len: int = 1024
        self.turn_slice: tuple = (100.0, 100.0)
        self.starting: bool = True
        self.coor: tuple = (0, 0)
        self.sigma: tuple = (0, 0)
        self.turn_arrays: nparray = np.ndarray([])
        self.x_bound: list = [0.345, 0.365]
        self.z_bound: list = [0.2, 0.4]

        self.chan_datatxzi = cda.VChan(**chans_conf['datatxzi'])
        self.chan_datatxzi.valueMeasured.connect(self.data_proc)
        self.chan_numpts = cda.DChan(**chans_conf['numpts'])
        self.chan_tunes_range = cda.StrChan(**chans_conf['tunes_range'])
        self.chan_tunes_range.valueMeasured.connect(self.tunes_range)
예제 #7
0
    def __init__(self):
        srv = "cxhw:5."
        hostname = node()
        cx_devname = hostname.replace('-', '_')
        base_dir = '/sys/bus/w1/devices/'
        device_folder = glob.glob(base_dir + '28*')[0]
        device_file = device_folder + '/w1_slave'

        self.cpu_t = CPUTemperature()
        self.la = LoadAverage()

        self.cpu_t_chan = cda.DChan(srv + cx_devname + ".cputemp")
        self.room_t_chan = cda.DChan(srv + cx_devname + ".roomtemp")
        self.la_chan = cda.DChan(srv + cx_devname + ".loadaverage")

        self.room_t_dev = open(device_file, 'r')
        os.set_blocking(self.room_t_dev.fileno(), False)  # make it nonblocking
        self.file_ev = cda.FdEvent(self.room_t_dev)
        self.file_ev.ready.connect(self.fd_ready)
    def __init__(self, source, inf_type):
        super(InfDef, self).__init__()
        self.source = source
        self.inf_type = inf_type
        self.cur_val = np.ndarray([])

        # make linspace
        self.good_t_arr = np.arange(0.0, 200.0, 1) * 5.6

        # self.chan_time_good = cda.VChan("cxhw:2." + source + "." + inf_type + ".Tgood", max_nelems=1024)
        # self.chan_time_temp = cda.VChan("cxhw:2." + source + "." + inf_type + ".Ttemp", max_nelems=1024)
        self.chan_volt_good = cda.VChan("cxhw:2." + source + "." + inf_type +
                                        ".Ugood",
                                        max_nelems=200)
        self.chan_volt_temp = cda.VChan("cxhw:2." + source + "." + inf_type +
                                        ".Utemp",
                                        max_nelems=200)
        self.chan_n_interp = cda.DChan("cxhw:2." + source + "." + inf_type +
                                       ".n_interp")
        self.chan_delta_arr = cda.VChan("cxhw:2." + source + "." + inf_type +
                                        ".delta_t_array",
                                        max_nelems=200)
    def __init__(self, cycle_part, conf_name, data_proc, dir_d):
        super(InfWorkMode, self).__init__()
        self.dir = dir_d + '/km_'
        self.ic_mode = ''
        self.active_tab = {'p': 1, 'e': 0}

        self.data_proc = data_proc
        self.cycle_part = cycle_part
        adc_list, p_names, e_names = load_config(conf_name)
        self.adcs = [ADC(self.data_receiver, name) for name in adc_list]
        self.inflectors = {
            "p":
            {key: InfDef(cycle_part, val)
             for key, val in p_names.items()},
            "e":
            {key: InfDef(cycle_part, val)
             for key, val in e_names.items()}
        }

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

        self.chan_ic_mode.valueChanged.connect(self.kkr_sel)
예제 #10
0
    def __init__(self, data_receiver, name, n_elems=200):
        super(ADC, self).__init__()
        self.name = name
        self.data_receiver = data_receiver

        self.chan_line_pos = cda.VChan("cxhw:18." + name + ".line1",
                                       max_nelems=n_elems)
        self.chan_line_neg = cda.VChan("cxhw:18." + name + ".line2",
                                       max_nelems=n_elems)
        self.chan_adc200_ptsofs = cda.DChan("cxhw:18." + name + ".ptsofs")
        self.chan_adc200_numpts = cda.DChan("cxhw:18." + name + ".numpts")
        self.chan_adc200_timing = cda.DChan("cxhw:18." + name + ".timing")
        self.chan_adc200_frq_div = cda.DChan("cxhw:18." + name + ".frqdiv")
        self.chan_range_pos = cda.DChan("cxhw:18." + name + ".range1")
        self.chan_range_neg = cda.DChan("cxhw:18." + name + ".range2")

        self.chan_line_pos.valueMeasured.connect(self.data_proc)
        self.chan_line_neg.valueMeasured.connect(self.data_proc)
예제 #11
0
    def __init__(self):
        dname = ctl_server + '.dcct.'

        # voltage measurement channel
        self.dcctv_chan = cda.DChan("canhw:21.ring_current", on_update=True)

        # input chans
        self.u2i_chan = cda.DChan(dname + 'u2i', on_update=True)
        self.adczero_chan = cda.DChan(dname + 'ADCzero', on_update=True)
        self.storage_fitl_chan = cda.IChan(dname + 'storage_fitlength',
                                           on_update=True)
        self.life_fitl_chan = cda.IChan(dname + 'life_fitlength',
                                        on_update=True)

        # output channels
        self.beamcur_chan = cda.DChan(dname + 'beamcurrent')
        self.storage_rate_chan = cda.DChan(dname + 'storagerate')
        self.lifetime_chan = cda.DChan(dname + 'lifetime')

        self.params = {
            'u2i': 20.51,
            'ADCzero': 0.0,
            'storage_fitlength': 10,
            'life_fitlength': 10,
        }

        self.u2i_chan.valueChanged.connect(self.parUpdate)
        self.adczero_chan.valueChanged.connect(self.parUpdate)
        self.storage_fitl_chan.valueChanged.connect(self.parUpdate)
        self.life_fitl_chan.valueChanged.connect(self.parUpdate)

        self.dcctv_chan.valueMeasured.connect(self.dcctv_measured)

        # data owner arrays
        self.I = np.zeros(10)
        self.t = np.zeros(10)
        # copy arrays for shifted views
        self.Is = self.I
        self.ts = self.t
예제 #12
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@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_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
        }
예제 #13
0
#!/usr/bin/env python3

import pycx4.pycda as cda

import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)


def print_rslv(chan):
    print(chan.name, chan.rslv_str)


def print_val(chan):
    print(chan.name, chan.val, chan.rslv_str)


chan = cda.DChan('canhw:11.QL1.Iset')
chan.resolve.connect(print_rslv)
chan.valueMeasured.connect(print_val)

cda.main_loop()
예제 #14
0
 def add_orbit_rma_corr_(self, **kwargs):
     cor = kwargs.get('cor')
     channel = cda.DChan(cor['name'] + '.Iset', private=1)
     self.orbit_rma_knob[cor['name'].split('.')[-1]] = [channel, cor['step']]
#!/usr/bin/env python3
import sys
import os

# since protocol requires
#flags = sys.getdlopenflags()
#sys.setdlopenflags(flags | os.RTLD_GLOBAL)
import pycx4.pycda as cda
#sys.setdlopenflags(flags)

import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)


def printval(chan):
    print(chan.val)


chan1 = cda.Chan("canhw:13.S13_out.Imes")
chan1.valueMeasured.connect(printval)

#cont = cda.Context("")

chan = cda.DChan("EPICS::V5:PA:Current1M")  # , context=cont)
chan.valueMeasured.connect(printval)

cda.main_loop()
예제 #16
0
 def create_chan(self, protocol, name, **kwargs):
     if protocol == 'cx':
         return cda.DChan(name, **kwargs)
     if protocol == 'EPICS':
         return cda.DChan()
     return None
예제 #17
0
#!/usr/bin/env python

import pycx4.pycda as cda

import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)


def print_event(cont):
    print(cont)


context = cda.Context("localhost:1.NAME")
context.serverCycle.connect(print_event)
context.enable_serverCycle()

# no chans - no context events :-)
c = cda.DChan("%d" % 0, context)

cda.main_loop()
예제 #18
0

nchans = 10000
i = 0

def printval(chan):
    global i
    i += 1
    if i == 10000000:
        print(chan.val)
        t2 = time.time()
        print('time1 = %f ' % (t1-t0))
        print("time2 = %f " % (t2-t1))
        cda.break_()

t0 = time.time()

context = cda.Context("localhost:1.NAME")

chans = []

for x in range(nchans):
    chans.append(cda.DChan("%d" % x, context))

for x in chans:
    x.valueChanged.connect(printval)

t1 = time.time()

cda.main_loop()