def get_alarms(blm_names): print 'n alarms', len(blm_names) alarm_vals = np.zeros(len(blm_names)) for i in xrange(len(blm_names)): #blm_channel = 'TTF2.DIAG/BLM/'+blm_names[i]+'/CH00.TD' #blm_channel = 'FLASH.DIAG/BLM/'+blm_names[i]+'/SIGNAL.TD' #print 'reading blm channel', blm_channel #blm_channel = blms[i].id + '/CH00.TD' #h = np.array(dcs.get_device_td(blm_channel)) #print 'max:', np.max( np.abs(h) ) if blm_names[i].find('FL2') > 0: alarm_val = 2000 blm_channel = 'FLASH.DIAG/BLM/'+blm_names[i]+'/SIGNAL.TD' else: blm_channel = 'TTF2.DIAG/BLM/'+blm_names[i]+'/CH00.TD' blm_alarm_ch = ('TTF2.DIAG/BLM/'+blm_names[i]).replace('BLM', 'BLM.ALARM') + '/THRFHI' blm_alarm_ch = ('FLASH.DIAG/BLM/'+blm_names[i]).replace('BLM', 'BLM.ALARM') + '/THRFHI' print 'reading alarm channel', blm_alarm_ch alarm_val = dcs.get_device_val(blm_alarm_ch) * 1.25e-3 # alarm thr. in Volts print 'alarm:', alarm_val h = np.array(dcs.get_device_td(blm_channel)) alarm_vals[i] = np.max( np.abs(h) ) / alarm_val #print alarm_vals return alarm_vals
def get_spectrum(f=None, detector='tunnel_default'): if detector == 'sflash': spec = np.array(dcs.get_device_td('TTF2.EXP/CAM.SFELC/SFELCCD/SPECTRUM.X.TD')) f = np.linspace(0, 1, len(spec)) return f, spec f_min = 13.0 f_max = 14.0 spec = np.array(dcs.get_device_td('TTF2.EXP/PBD.PHOTONWL.ML/WAVE_LENGTH/VAL.TD')) if f == None: f = np.linspace(f_min, f_max, len(spec)) return f, spec
def get_sase(detector='gmd_default'): if detector == 'mcp': # incorrect return dcs.get_device_val('TTF2.DIAG/MCP.HV/MCP.HV1/HV_CURRENT') #return np.abs( np.mean(h) ) if detector == 'flash2.mcp': v = 0.0 n_av = 100 for i in range(0,n_av): v += np.max( np.abs(dcs.get_device_td('FLASH.DIAG/MCP.ADC/FL2MCP/MCP1.TD'))) return v / n_av #return np.abs( np.mean(h) ) if detector == 'sflash.mcp': val = 0.0 #h = dcs.get_device_td('TTF2.EXP/DIAGMCP.ADC/SFLASH2.0/CH02.TD') #return np.max(h) for i in range(0,1000): h = dcs.get_device_td('TTF2.EXP/DIAGMCP.ADC/SFLASH2.0/CH02.TD') if val < np.max(h): val = np.max(h) sleep(0.001) #val += h[700] / 100.0 #return h[7000] return val if detector == 'gmd_fl1_slow': return dcs.get_device_val('TTF2.FEL/BKR.FLASH.STATE/BKR.FLASH.STATE/SLOW.INTENSITY' ) # default 'BKR' gmd h = np.array(dcs.get_device_td('TTF2.FEL/BKR.FLASH.STATE/BKR.FLASH.STATE/ENERGY.CLIP.SPECT')) val = np.mean(h) return val '''
def get_alarms(): #print 'n alarms', len(blm_names) alarm_vals = np.zeros(len(blm_names)) for i in xrange(len(blm_names)): blm_channel = blms[i].id + '/CH00.TD' h = np.array(dcs.get_device_td(blm_channel)) #print 'max:', np.max( np.abs(h) ) blm_alarm_ch = blms[i].id.replace('BLM', 'BLM.ALARM') + '/THRFHI' alarm_val = dcs.get_device_val( blm_alarm_ch) * 1.25e-3 # alarm thr. in Volts #print 'alarm:', alarm_val alarm_vals[i] = np.max(np.abs(h)) / alarm_val return alarm_vals
from pylab import * import ocelot.mint.swig.dcs as dcs print 'rf test...' rf_channel = 'FLASH.RF/LLRF.DAQ/VS.ACC23/AMPL.TD' rf_channel_ampl = 'FLASH.RF/LLRF.CONTROLLER/CTRL.ACC23/SP.AMPL' rf_channel_ph = 'FLASH.RF/LLRF.CONTROLLER/CTRL.ACC23/SP.PHASE' rf_ampl = dcs.get_device_val(rf_channel_ampl) rf_ph = dcs.get_device_val(rf_channel_ph) print 'rf:', rf_ampl, rf_ph h = np.array(dcs.get_device_td(rf_channel)) print np.max( np.abs(h) ), len(h) pyro_1_ch = 'TTF2.FEEDBACK/LONGITUDINAL/MONITOR5/MEAN_AVG' print 'pyro1:', dcs.get_device_val(pyro_1_ch) pyro_2_ch = 'TTF2.FEEDBACK/LONGITUDINAL/MONITOR8/MEAN_AVG' print 'pyro2:', dcs.get_device_val(pyro_2_ch) plt.plot(h) plt.show()
bpm_names = ['2UND1', '2UND2', '2UND4', '2UND5', '2UND6'] blm_names = ['1R.UND3'] for bpm_name in bpm_names: bpm = dcs.BPM("TTF2.DIAG/BPM/" + bpm_name) dcs.get_bpm_val(bpm) print 'bpm read:', bpm.id, bpm.x, bpm.y, bpm.z_pos for blm_name in blm_names: blm = dcs.Device("TTF2.DIAG/BLM/" + blm_name) dcs.get_device_info(blm) blm_channel = blm.id + '/CH00.TD' print 'blm info:', blm.id, bpm.z_pos h = np.array(dcs.get_device_td(blm_channel)) print 'max:', np.max(h) blm_alarm_ch = "TTF2.DIAG/BLM.ALARM/" + blm_name + '/THRFHI' val = dcs.get_device_val(blm_alarm_ch) print 'alarm:', val * 1.25e-3 gmd_channel = 'TTF2.DAQ/PHFLUX/OUT33/VAL' mag_channel = 'TTF2.MAGNETS/STEERER/H3UND1/PS.RBV' #blm_channel = 'TTF2.DIAG/BLM/1R.UND1/CH00.TD' blm_channel = 'FLASH.DIAG/BLM/3.2FL2SASE3/SIGNAL.TD' h = np.array(dcs.get_device_td(blm_channel)) print 'sum:', np.sum(h) #plt.plot(h) #plt.show()
bpm_names = ['2UND1', '2UND2', '2UND4', '2UND5', '2UND6'] blm_names = ['1R.UND3'] for bpm_name in bpm_names: bpm = dcs.BPM("TTF2.DIAG/BPM/" + bpm_name) dcs.get_bpm_val(bpm) print 'bpm read:', bpm.id, bpm.x, bpm.y, bpm.z_pos for blm_name in blm_names: blm = dcs.Device("TTF2.DIAG/BLM/" + blm_name) dcs.get_device_info(blm) blm_channel = blm.id + '/CH00.TD' print 'blm info:', blm.id, bpm.z_pos h = np.array(dcs.get_device_td(blm_channel)) print 'max:', np.max(h) blm_alarm_ch = "TTF2.DIAG/BLM.ALARM/" + blm_name + '/THRFHI' val = dcs.get_device_val(blm_alarm_ch) print 'alarm:', val * 1.25e-3 gmd_channel = 'TTF2.DAQ/PHFLUX/OUT33/VAL' mag_channel = 'TTF2.MAGNETS/STEERER/H3UND1/PS.RBV' #blm_channel = 'TTF2.DIAG/BLM/1R.UND1/CH00.TD' blm_channel = 'FLASH.DIAG/BLM/3.2FL2SASE3/SIGNAL.TD' h = np.array(dcs.get_device_td(blm_channel)) print 'sum:', np.sum(h) #plt.plot(h)