(filln, tref_string, group_name, title_string))
    fig_h.canvas.set_window_title(group_name + ' %i' % filln)

    hl_var_names = dict_hl_groups[group_name][:]
    hl_var_names_copy = dict_hl_groups[group_name][:]
    for varname in hl_var_names_copy:
        if varname in blacklist:
            hl_var_names.remove(varname)

    heatloads = SetOfHomogeneousNumericVariables(variable_list=hl_var_names,
                                                 timber_variables=fill_dict)

    # Model heat load
    hl_imped_fill = fc.HeatLoad_calculated_fill(fill_dict,
                                                hli_calculator,
                                                bct_dict=bct_bx,
                                                fbct_dict=fbct_bx,
                                                blength_dict=blength_bx)
    hl_sr_fill = fc.HeatLoad_calculated_fill(fill_dict,
                                             hlsr_calculator,
                                             bct_dict=bct_bx,
                                             fbct_dict=fbct_bx,
                                             blength_dict=blength_bx)
    hl_total_model = (hl_imped_fill.heat_load_calculated_total +
                      hl_sr_fill.heat_load_calculated_total) * 53.45
    hl_model_t_stamps = (hl_imped_fill.t_stamps -
                         hl_imped_fill.t_stamps[0]) / 3600.

    # CORRECT ARC AVERAGES
    if not use_recalculated and group_name == 'Arcs' and filln < first_correct_filln:
        hl_corr_factors = []
Пример #2
0
if args.contributions:
    fig = ms.figure('Heat load contributions', figs)
    fig.subplots_adjust(right=0.75, wspace=0.45, hspace=0.4)
    sp = None

    fill_dict.update(
        tm.parse_timber_file(
            './fill_bunchbybunch_data_csvs/bunchbybunch_data_fill_%d.csv' %
            filln,
            verbose=False))

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

    hl_imped_fill = fc.HeatLoad_calculated_fill(fill_dict, hli_calculator)
    hl_sr_fill = fc.HeatLoad_calculated_fill(fill_dict, hlsr_calculator)

    model_time = (hl_sr_fill.t_stamps - t_ref) / 3600

    t_start_injphys = (dict_fill_bmodes[filln]['t_start_INJPHYS'] -
                       t_ref) / 3600.

    def compute_offset(tt, yy):
        mask_offset = np.logical_and(tt < t_start_injphys,
                                     tt > t_start_injphys - 600)
        offset = np.mean(yy[mask_offset])
        return offset

    for cell_ctr, cell in enumerate(cells):
        sp_ctr = cell_ctr % 4 + 1
def extract_and_compute_extra_fill_data(fill_dict,
                                        t_ref,
                                        t_sample_h,
                                        thresh_bint=3e10):

    from LHCMeasurementTools.LHC_FBCT import FBCT
    from LHCMeasurementTools.LHC_BCT import BCT
    from LHCMeasurementTools.LHC_BQM import blength
    from LHCMeasurementTools.LHC_Energy import energy

    import HeatLoadCalculators.impedance_heatload as ihl
    import HeatLoadCalculators.synchrotron_radiation_heatload as srhl
    import HeatLoadCalculators.FillCalculator as fc

    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)

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

    hl_imped_fill = fc.HeatLoad_calculated_fill(fill_dict,
                                                hli_calculator,
                                                bct_dict=bct_bx,
                                                fbct_dict=fbct_bx,
                                                blength_dict=blength_bx)
    hl_sr_fill = fc.HeatLoad_calculated_fill(fill_dict,
                                             hlsr_calculator,
                                             bct_dict=bct_bx,
                                             fbct_dict=fbct_bx,
                                             blength_dict=blength_bx)

    hl_imped_sample = hl.magnet_length['AVG_ARC'][0] * np.interp(
        t_sample_h, (hl_imped_fill.t_stamps - t_ref) / 3600,
        hl_imped_fill.heat_load_calculated_total)
    hl_sr_sample = hl.magnet_length['AVG_ARC'][0] * np.interp(
        t_sample_h, (hl_imped_fill.t_stamps - t_ref) / 3600,
        hl_sr_fill.heat_load_calculated_total)

    intensity_b1 = np.interp(t_sample_h, (bct_bx[1].t_stamps - t_ref) / 3600,
                             bct_bx[1].values)
    intensity_b2 = np.interp(t_sample_h, (bct_bx[2].t_stamps - t_ref) / 3600,
                             bct_bx[2].values)

    bl_ave_b1 = np.interp(t_sample_h, (blength_bx[1].t_stamps - t_ref) / 3600,
                          blength_bx[1].avblen)
    bl_ave_b2 = np.interp(t_sample_h, (blength_bx[2].t_stamps - t_ref) / 3600,
                          blength_bx[2].avblen)

    n_bunches_b1 = np.sum(fbct_bx[1].nearest_older_sample(t_sample_h * 3600 +
                                                          t_ref) > thresh_bint)
    n_bunches_b2 = np.sum(fbct_bx[2].nearest_older_sample(t_sample_h * 3600 +
                                                          t_ref) > thresh_bint)

    energy_GeV = energy(fill_dict,
                        beam=1).nearest_older_sample(t_sample_h * 3600 + t_ref)

    return intensity_b1, intensity_b2, bl_ave_b1, bl_ave_b2, n_bunches_b1, n_bunches_b2, energy_GeV, hl_imped_sample, hl_sr_sample