data_folder_fill +
                '/fill_bunchbybunch_data_csvs/bunchbybunch_data_fill_%d.csv' %
                filln,
                verbose=False))
        if use_recalculated:
            fill_dict.update(qf.get_fill_dict(filln))
        else:
            fill_dict.update(
                tm.parse_timber_file(
                    data_folder_fill +
                    '/fill_heatload_data_csvs/heatloads_fill_%d.csv' % filln,
                    verbose=False))
    elif os.path.isdir(data_folder_fill + '/fill_basic_data_h5s'):
        fill_dict.update(
            tm.CalsVariables_from_h5(
                data_folder_fill +
                '/fill_basic_data_h5s/basic_data_fill_%d.h5' % filln, ))
        fill_dict.update(
            tm.CalsVariables_from_h5(
                data_folder_fill +
                '/fill_bunchbybunch_data_h5s/bunchbybunch_data_fill_%d.h5' %
                filln, ))
        if use_recalculated:
            fill_dict.update(qf.get_fill_dict(filln))
        else:
            fill_dict.update(
                tm.CalsVariables_from_h5(
                    data_folder_fill +
                    '/fill_heatload_data_h5s/heatloads_fill_%d.h5' % filln, ))

    for csv in added_csvs:
for filln in sorted(dict_fill_bmodes.keys())[::-1]:
    print('Fill %i' % filln)
    h5filename = h5folder + '/imp_and_SR_fill_%d.h5' % filln

    if dict_fill_bmodes[filln]['flag_complete'] is False:
        print("Fill incomplete --> no h5 convesion")
        continue

    if os.path.isfile(h5filename):
        print("Already complete and in h5")
        continue
    try:
        fill_dict = {}
        fill_dict.update(
            tm.CalsVariables_from_h5(
                'fill_basic_data_h5s/basic_data_fill_%d.h5' % filln))
        fill_dict.update(
            tm.CalsVariables_from_h5(
                'fill_bunchbybunch_data_h5s/bunchbybunch_data_fill_%d.h5' %
                filln))

        fbct_bx = {}
        bct_bx = {}
        blength_bx = {}
        for beam_n in (1, 2):
            fbct_bx[beam_n] = FBCT(fill_dict, beam=beam_n)
            bct_bx[beam_n] = BCT(fill_dict, beam=beam_n)
            blength_bx[beam_n] = blength(fill_dict, beam=beam_n)

        hl_imped_fill = fc.HeatLoad_calculated_fill(fill_dict,
                                                    hli_calculator,
Example #3
0
    filln = snapshots[i_snapshot]['filln']
    t_sample_h = snapshots[i_snapshot]['t_h']
    t_offset_h = snapshots[i_snapshot]['t_offs_h']

    # get location of current data
    data_folder_fill = dict_fill_bmodes[filln]['data_folder']
    t_fill_st = dict_fill_bmodes[filln]['t_startfill']
    t_fill_end = dict_fill_bmodes[filln]['t_endfill']
    t_ref = t_fill_st
    tref_string = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(t_ref))
    tref_string_short = time.strftime("%d %b %Y %H:%M", time.localtime(t_ref))

    if from_published:
        fill_file = f"{data_folder_fill}/fill_cell_by_cell_heatload_data_h5s/cell_by_cell_heatloads_fill_{filln}.h5"
        hid = tm.CalsVariables_from_h5(fill_file)
    else:
        hid = qf.get_fill_dict(filln, h5_storage=H5_storage(recalc_h5_folder))

    # extract standard fill data
    fill_dict = {}
    if os.path.isdir(data_folder_fill + '/fill_basic_data_csvs'):
        # 2016 structure
        fill_dict.update(
            tm.parse_timber_file(
                data_folder_fill +
                '/fill_basic_data_csvs/basic_data_fill_%d.csv' % filln,
                verbose=args.v))
        fill_dict.update(
            tm.parse_timber_file(
                data_folder_fill +
    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)

    data_folder_fill = dict_fill_bmodes[filln_offset]['data_folder']

    try:
        fill_dict = tm.timber_variables_from_h5(data_folder_fill+'/heatloads_fill_h5s/heatloads_all_fill_%d.h5'%filln_offset)
        print('From h5!')
    except IOError:
        print("h5 file not found, using h5s :-P")
        fill_dict = {}
        fill_dict.update(tm.CalsVariables_from_h5(
            data_folder_fill + ('/fill_basic_data_h5s/'
                'basic_data_fill_%d.h5'%filln_offset)))
        fill_dict.update(tm.CalsVariables_from_h5(
            data_folder_fill + ('/fill_heatload_data_h5s/'
                'heatloads_fill_%d.h5'%filln_offset)))

    if args.use_recalc:
        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())
import sys, os
BIN = os.path.expanduser("../")
sys.path.append(BIN)

# Load fills
import LHCMeasurementTools.TimberManager as tm

filln = 6740

fill_dict = {}
fill_dict.update(
    tm.CalsVariables_from_h5(
        ('../../LHC_followup_download_scripts/fill_basic_data_h5s'
         '/basic_data_fill_%d.h5' % filln)))
fill_dict.update(
    tm.CalsVariables_from_h5(
        ('../../LHC_followup_download_scripts/fill_bunchbybunch_data_h5s/'
         'bunchbybunch_data_fill_%d.h5' % filln)))

# Build heat load calculators
import impedance_heatload as ihl
import synchrotron_radiation_heatload as srhl

hli_calculator = ihl.HeatLoadCalculatorImpedanceLHCArc()
hlsr_calculator = srhl.HeatLoadCalculatorSynchrotronRadiationLHCArc()

# Use fill calculator
import FillCalculator as fc

hl_imped_fill = fc.HeatLoad_calculated_fill(fill_dict, hli_calculator)
hl_sr_fill = fc.HeatLoad_calculated_fill(fill_dict, hlsr_calculator)
Example #6
0
t_ref = dict_fill_bmodes[filln]['t_startfill']
tref_string = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(t_ref))

fill_dict = {}
if os.path.isdir(data_folder_fill + '/fill_basic_data_csvs'):
    fill_dict.update(
        tm.parse_timber_file(
            data_folder_fill +
            '/fill_bunchbybunch_data_csvs/bunchbybunch_data_fill_%d.csv' %
            filln,
            verbose=False))
elif os.path.isdir(data_folder_fill + '/fill_basic_data_h5s'):
    fill_dict.update(
        tm.CalsVariables_from_h5(
            data_folder_fill +
            '/fill_bunchbybunch_data_h5s/bunchbybunch_data_fill_%d.h5' %
            filln, ))
else:
    raise ValueError('What?!')

i_fig = 0
plt.close('all')
# Loop over beams
beam_col = ['b', 'r']
for beam in [1, 2]:
    print('\nPreparing plot beam %d...' % beam)

    fbct = FBCT.FBCT(fill_dict, beam=beam)
    dt = np.diff(fbct.t_stamps)[0]
    fbct_t_all, fbct_v_all = fbct.uniform_time(t_inter=dt)
    nslots = fbct_v_all.shape[1]
Example #7
0
        xlim = None, None

    if '--notrace' in sys.argv:
        list_scan_times = []

fill_dict = {}
if os.path.isdir(data_folder_fill + '/fill_basic_data_csvs'):
    fill_dict.update(
        tm.parse_timber_file(
            data_folder_fill +
            '/fill_basic_data_csvs/basic_data_fill_%d.csv' % filln,
            verbose=True))
elif os.path.isdir(data_folder_fill + '/fill_basic_data_h5s'):
    fill_dict.update(
        tm.CalsVariables_from_h5(
            data_folder_fill +
            '/fill_basic_data_h5s/basic_data_fill_%d.h5' % filln, ))

pl.close('all')
sp_ploss = None

# START PLOT
fig_h = pl.figure(1, figsize=(8 * 1.6, 6 * 1.3))
fig_h.patch.set_facecolor('w')
ms.mystyle_arial(fontsz=16, dist_tick_lab=5)
fig_h.suptitle('Fill %d: started on %s' % (filln, tref_string), fontsize=18)

sp_int = pl.subplot2grid((2, 3), (0, 0), rowspan=1)
sp_energy = sp_int.twinx()

sp_totploss = pl.subplot2grid((2, 3), (1, 0), rowspan=1, sharex=sp_int)
Example #8
0
        plotaveonly = True


fill_dict = {}
if os.path.isdir(data_folder_fill+'/fill_basic_data_csvs'):
    # 2016+ structure
    fill_dict.update(tm.parse_timber_file(
        data_folder_fill+'/fill_basic_data_csvs/basic_data_fill_%d.csv'%filln,
        verbose=True))
    fill_dict.update(tm.parse_timber_file(
        (data_folder_fill +
            '/fill_bunchbybunch_data_csvs/bunchbybunch_data_fill_%d.csv'%filln),
        verbose=True))
elif os.path.isdir(data_folder_fill+'/fill_basic_data_h5s'):
    # 2016+ structure
    fill_dict.update(tm.CalsVariables_from_h5(
        data_folder_fill+'/fill_basic_data_h5s/basic_data_fill_%d.h5'%filln))
    fill_dict.update(tm.CalsVariables_from_h5(
        (data_folder_fill +
            '/fill_bunchbybunch_data_h5s/bunchbybunch_data_fill_%d.h5'%filln)))
else:
    # 2015 structure
    fill_dict.update(tm.parse_timber_file(data_folder_fill+'/fill_csvs/fill_%d.csv'%filln, verbose=True))
        
beam_col = ['k', 'b','r']

sp_sigma_h = None
sp_t = None
pl.close('all')
ms.mystyle_arial(fontsz=16, dist_tick_lab=5)

spemit = None