data.update(ldb.get([ 'HX:BETASTAR_IP1', 'CMS:LUMI_TOT_INST', 'ATLAS:LUMI_TOT_INST', ], t_start, t_stop)) print 'Downloaded Beta' data.update(ldb.getScaled(['RPMBB.RR17.ROD.A12B1:I_MEAS', 'RPMBB.RR17.ROD.A12B2:I_MEAS'], t_start, t_stop, scaleAlgorithm='AVG', scaleInterval='MINUTE',scaleSize='1')) print 'Downloaded Octupole current' import matplotlib.pyplot as plt import matplotlib.cm as cm plt.close('all') ms.mystyle_arial(fontsz=16, dist_tick_lab=5) axt = None axbun = None axbet = None ax_lifet_obs = None figlist = [] fig_obs = plt.figure(200, figsize=(8*1.5, 6)) fig_obs.set_facecolor('w') for beam in [1,2]: spbet_list = [] bint = data['LHC.BCTFR.A6R4.B%d:BUNCH_INTENSITY'%beam][1]
fill_dict = {} fill_dict.update(tm.parse_timber_file(data_folder_fill+'/fill_basic_data_csvs/basic_data_fill_%d.csv'%filln_offset, verbose=False)) fill_dict.update(tm.parse_timber_file(data_folder_fill+'/fill_heatload_data_csvs/heatloads_fill_%d.csv'%filln_offset, verbose=False)) if args.use_recalc: #import GasFlowHLCalculator.qbs_fill as qf fill_dict.update(qf.get_fill_dict(filln_offset,h5_storage=H5_storage(recalc_h5_folder),use_dP=True)) dict_offsets={} for kk in hl_varlist: dict_offsets[kk] = np.interp(t_zero_unix, np.float_(np.array(fill_dict[kk].t_stamps)), fill_dict[kk].float_values()) pl.close('all') ms.mystyle_arial(fontsz=fontsz, dist_tick_lab=9) fig = pl.figure(1, figsize=figsz) fig.patch.set_facecolor('w') ax1 = fig.add_subplot(311) ax11 = ax1.twinx() ax2 = fig.add_subplot(312, sharex=ax1) ax3 = fig.add_subplot(313, sharex=ax1) ms.sciy() N_fills = len(fill_list) t_for_integrated = [] hl_for_integrated = [] first_fill = True
colstr[2] = 'r' energy = Energy.energy(fill_dict, beam=1) t_fill_st = dict_fill_bmodes[filln]['t_startfill'] t_fill_end = dict_fill_bmodes[filln]['t_endfill'] t_fill_len = t_fill_end - t_fill_st t_min = dict_fill_bmodes[filln]['t_startfill'] - 0 * 60. t_max = dict_fill_bmodes[filln]['t_endfill'] + 0 * 60. t_ref = t_fill_st tref_string = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(t_ref)) pl.close('all') ms.mystyle_arial(fontsz=myfontsz, dist_tick_lab=8) fbct_bx = {} bct_bx = {} blength_bx = {} for beam_n in beams_list: fbct_bx[beam_n] = FBCT(fill_dict, beam=beam_n) bct_bx[beam_n] = BCT(fill_dict, beam=beam_n) if flag_bunch_length: blength_bx[beam_n] = blength(fill_dict, beam=beam_n) #dict_hl_data = tm.parse_timber_file('heatloads_fill_csvs/heatloads_all_special_fill_%d.csv'%filln) dict_hl_data = fill_dict group_names = dict_hl_groups.keys()
t_fill_st = dict_fill_bmodes[filln]['t_startfill'] t_fill_end = dict_fill_bmodes[filln]['t_endfill'] t_fill_len = t_fill_end - t_fill_st t_min = dict_fill_bmodes[filln]['t_startfill']-0*60. t_max = dict_fill_bmodes[filln]['t_endfill']+0*60. t_ref=t_fill_st tref_string=time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(t_ref)) pl.close('all') ms.mystyle_arial(fontsz=myfontsz, dist_tick_lab=8) fbct_bx = {} bct_bx = {} blength_bx = {} for beam_n in beams_list: fbct_bx[beam_n] = FBCT(fill_dict, beam = beam_n) bct_bx[beam_n] = BCT(fill_dict, beam = beam_n) if flag_bunch_length: blength_bx[beam_n] = blength(fill_dict, beam = beam_n) #dict_hl_data = tm.parse_timber_file('heatloads_fill_csvs/heatloads_all_special_fill_%d.csv'%filln) dict_hl_data = fill_dict
# check consistency in cell naming for i_snapshot in range(N_snapshots): for s in hl.sector_list(): if len(snapshots[i_snapshot]['dict_hl_cell_by_cell'][s]['cell_names'] ) != len(snapshots[0]['dict_hl_cell_by_cell'][s]['cell_names']): raise ValueError('Found inconsistency type 1 in dict!') for c1, c2 in zip( snapshots[i_snapshot]['dict_hl_cell_by_cell'][s]['cell_names'], snapshots[0]['dict_hl_cell_by_cell'][s]['cell_names']): if c1 != c2: raise ValueError('Found inconsistency type 2 in dict!') # Plots! plt.close('all') myfontsz = 13 ms.mystyle_arial(fontsz=13, dist_tick_lab=3) if N_snapshots == 1: width = 0.6 else: width = 0.8 spshare = None spsharehist = None colorlist = ['b', 'r', 'g'] colorleglist = ['#7F7FFF', '#FF7F7F', '#7FBF7F'] x_hist = np.linspace(minhist, maxhist, 1000) y_list = [] figlist = [] for i, s in enumerate(hl.sector_list()): #single sector plot
if zero_at is not None: if ':' in zero_at: t_zero_unix = time.mktime(time.strptime(zero_at, '%d-%m-%Y,%H:%M')) else: t_zero_unix = t_ref_unix + float(zero_at)*3600. filln_offset = fill_info.filln_at_time(t_zero_unix) fill_dict = {} fill_dict.update(tm.parse_timber_file('fill_basic_data_csvs/basic_data_fill_%d.csv'%filln_offset, verbose=False)) fill_dict.update(tm.parse_timber_file('fill_heatload_data_csvs/heatloads_fill_%d.csv'%filln_offset, verbose=False)) dict_offsets={} for kk in hl_varlist: dict_offsets[kk] = np.interp(t_zero_unix, np.float_(np.array(fill_dict[kk].t_stamps)), fill_dict[kk].float_values()) pl.close('all') ms.mystyle_arial(fontsz=fontsz, dist_tick_lab=9) #ms.mystyle(fontsz=fontsz) fig = pl.figure(1, figsize=figsz) fig.patch.set_facecolor('w') ax1 = fig.add_subplot(311) ax11 = ax1.twinx() ax2 = fig.add_subplot(312, sharex=ax1) ax3 = fig.add_subplot(313, sharex=ax1) ms.sciy() N_fills = len(fill_list) t_for_integrated = [] hl_for_integrated = [] first_fill = True