def main():
    path_gamma = get_astri_2019("d2019-05-15_simulations/gamma_1deg.h5")
    path_proton = get_astri_2019("d2019-05-15_simulations/proton.h5")
    base_output = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gamma1deg")
    n_off = 1
    process(path_gamma, path_proton, base_output, n_off)

    path_gamma = get_astri_2019("d2019-05-15_simulations/gamma_1deg.h5")
    path_proton = get_astri_2019("d2019-05-15_simulations/proton.h5")
    base_output = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gamma1deg_5off"
    )
    n_off = 5
    process(path_gamma, path_proton, base_output, n_off)

    path_gamma = get_astri_2019("d2019-05-15_simulations/gamma_0deg.h5")
    path_proton = get_astri_2019("d2019-05-15_simulations/proton.h5")
    base_output = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gamma0deg")
    n_off = 1
    process(path_gamma, path_proton, base_output, n_off)

    path_gamma = get_astri_2019("d2019-05-15_simulations/gamma_1deg.h5")
    path_proton = path_gamma
    base_output = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gammaonly")
    n_off = 1
    process_gamma_only(path_gamma, base_output, n_off)
Exemple #2
0
def process_file(file):
    name = file.__class__.__name__
    amplitude_path = get_data("d190117_trigger_stability/{}/amplitudes.h5".format(name))
    hv_path = get_data("d190117_trigger_stability/{}/hv.h5".format(name))
    output_dir = get_plot("d190117_trigger_stability/amp_vs_hv/{}".format(name))
    spoi = file.spoi
    process(amplitude_path, hv_path, output_dir, spoi)
Exemple #3
0
def main():
    paths = dict(
        self=get_data("d191118_pedestal_temperature/d191118/residuals_self.h5"),
        single_31degree=get_data("d191118_pedestal_temperature/d191118/residuals_single_30.h5"),
        lookup=get_data("d191118_pedestal_temperature/d191118/residuals_lookup.h5"),
        interp=get_data("d191118_pedestal_temperature/d191118/residuals_interp.h5"),
        pchip=get_data("d191118_pedestal_temperature/d191118/residuals_pchip.h5"),
    )

    p_hist = dict()

    for label, path in paths.items():
        with HDF5Reader(path) as reader:
            df = reader.read("data")
            df = df.set_index("temperature_r0_primary").sort_index()

        for temperature, row in df.iterrows():
            hist = row['hist']
            edges = row['edges']
            mean = row['mean']
            std = row['std']

            if temperature not in p_hist:
                p_hist[temperature] = HistPlot()
                p_hist[temperature].ax.set_title(f"TM Primary Temperature = {temperature:.2f} °C")

            p_hist[temperature].plot(hist, edges, mean, std, label)


    for temperature, plot in p_hist.items():
        plot.save(get_plot(f"d191118_pedestal_temperature/d191118/hist/T{temperature:.2f}.pdf"))
def main():
    path_ac_23 = get_data(
        "d191122_dc_tf/ac_tf/TFInput_File_SN0038_temp_23_180317.tcal")
    path_ac_cc_23 = get_data("d191122_dc_tf/ac_tf/ac_23deg_tf.h5")
    path_dc_ext23 = get_data(
        "d191122_dc_tf/dc_tf/dc_externalsync_23deg_tf.tcal")
    path_vped_23 = get_data("d191122_dc_tf/vped/VPED_23deg.h5")
    path_pedestal_23 = get_checs(
        "d181203_erlangen/pedestal/Pedestal_23deg_ped.tcal")

    tf_ac_23 = get_ac_tf(path_ac_23)
    tf_ac_cc_23 = get_ac_cc_tf(path_ac_cc_23)
    tf_dc_ext23 = get_dc_tf(path_dc_ext23, path_vped_23)
    pedestal_23 = get_pedestal(path_pedestal_23)

    # r0_paths = glob(get_checs("d181203_erlangen/dynrange/23deg/r0/Amplitude_*_Run_0_r0.tio"))
    # output_path = get_data("d191122_dc_tf/charge/dc_externalsync_23deg_charge.h5")
    # process(r0_paths, pedestal_23, tf_dc_ext23, output_path)
    #
    # r0_paths = glob(get_checs("d181203_erlangen/dynrange/23deg/r0/Amplitude_*_Run_0_r0.tio"))
    # output_path = get_data("d191122_dc_tf/charge/ac_23deg_charge.h5")
    # process(r0_paths, pedestal_23, tf_ac_23, output_path)

    r0_paths = glob(
        get_checs(
            "d181203_erlangen/dynrange/23deg/r0/Amplitude_*_Run_0_r0.tio"))
    output_path = get_data("d191122_dc_tf/charge/ac_cc_23deg_charge.h5")
    process(r0_paths, pedestal_23, tf_ac_cc_23, output_path)
Exemple #5
0
def main():
    input_path = get_data("d191122_dc_tf/vped/VPED_13deg.h5")
    output_path = get_plot("d191122_dc_tf/vped/VPED_13deg.pdf")
    process(input_path, output_path)

    input_path = get_data("d191122_dc_tf/vped/VPED_23deg.h5")
    output_path = get_plot("d191122_dc_tf/vped/VPED_23deg.pdf")
    process(input_path, output_path)

    input_path = get_data("d191122_dc_tf/vped/VPED_33deg.h5")
    output_path = get_plot("d191122_dc_tf/vped/VPED_33deg.pdf")
    process(input_path, output_path)

    input_path = get_data("d191122_dc_tf/vped/VPED_43deg.h5")
    output_path = get_plot("d191122_dc_tf/vped/VPED_43deg.pdf")
    process(input_path, output_path)

    input_path = get_data("d191122_dc_tf/vped/VPED_23deg.h5")
    output_path = get_plot("d191122_dc_tf/vped/VPED_23deg_sc.pdf")
    process_single_channel(input_path, 8, output_path)

    input_paths = [
        get_data("d191122_dc_tf/vped/VPED_13deg.h5"),
        get_data("d191122_dc_tf/vped/VPED_23deg.h5"),
        get_data("d191122_dc_tf/vped/VPED_33deg.h5"),
        get_data("d191122_dc_tf/vped/VPED_43deg.h5"),
    ]
    output_path = get_plot("d191122_dc_tf/vped/temperature_comparison.pdf")
    process_different_temps(input_paths, 8, output_path)

    input_path = get_data("d191122_dc_tf/vped/VPED_23deg.h5")
    mean_path = get_plot("d191122_dc_tf/vped/VPED_23deg_mean.pdf")
    std_path = get_plot("d191122_dc_tf/vped/VPED_23deg_std.pdf")
    process_mean_std(input_path, mean_path, std_path)
Exemple #6
0
def main():
    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/before_25deg.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)

    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp35/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/before_35deg.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)

    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp35_440pF_2/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_440pF/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/after_35deg.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)
    #
    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_440pF/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_440pF/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/after_25deg.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)

    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_440pF_3/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_440pF_3/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/after_25deg_3.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)

    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp35_440pF_3/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_440pF_3/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/after_35deg_3.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)

    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_100pF/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_100pF/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/100pF_25deg.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)
    #
    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp35_100pF/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_100pF/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/100pF_35deg.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)

    # tf_r0_paths = glob("/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_100_pF_1k/*.tio")
    # pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_100pF/VPED_1095_ped.tcal"
    # tf_path = get_data("d191128_pedestal_lab/dc_tf/100pF_1k_25deg.h5")
    # process(tf_r0_paths, pedestal_path, tf_path)

    tf_r0_paths = glob(
        "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_200_pF/*.tio"
    )
    pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_200_pF/VPED_1095_ped.tcal"
    tf_path = get_data("d191128_pedestal_lab/dc_tf/200pF_25deg.h5")
    process(tf_r0_paths, pedestal_path, tf_path)

    tf_r0_paths = glob(
        "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp35_200_pF/*.tio"
    )
    pedestal_path = "/Users/Jason/Downloads/tempdata/d191128_pedestal_lab/dc_tf_tm_temp25_200_pF/VPED_1095_ped.tcal"
    tf_path = get_data("d191128_pedestal_lab/dc_tf/200pF_35deg.h5")
    process(tf_r0_paths, pedestal_path, tf_path)
def main():
    input_path = "/Users/Jason/Software/TargetCalib/source/dev/mapping_checs_V1-1-0.cfg"
    output_path = get_data("d181105_sim_telarray_cfg/tc_mapping.cfg")
    create_new_mapping(input_path, output_path)

    input_path = get_data("d181105_sim_telarray_cfg/tc_mapping.cfg")
    output_path = get_data("d181105_sim_telarray_cfg/pixel_mapping.dat")
    create_new_camera_cfg(input_path, output_path)
Exemple #8
0
 def __init__(self):
     self.pde_x, self.pde_y = np.loadtxt(
         get_data('charge_resolution/pe_to_photons/PDE.csv'),
         unpack=True,
         delimiter=', ')
     self.crosstalk_x, self.crosstalk_y = np.loadtxt(
         get_data('charge_resolution/pe_to_photons/crosstalk.csv'),
         unpack=True,
         delimiter=', ')
Exemple #9
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.dl1_path = "/Volumes/gct-jason/sim_telarray/d180907_illumination_profile/Run43489_dl1.h5"
     self.illumination_profile_path = get_data(
         "d181021_charge_resolution/illumination_profile/d180907_MC.h5")
     self.plot_dir = get_plot(
         "d181021_charge_resolution/illumination_profile/d180907_MC")
     self.angular_response_path = get_data(
         "d181021_charge_resolution/illumination_profile/transmission_pmma_vs_theta_20150422.dat"
     )
Exemple #10
0
def main():
    path = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gamma1deg_onoff.h5"
    )
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gamma1deg_onoff_nocut.pdf")
    title = "ON/OFF MC (1deg) (No cuts)"
    process(path, output, title, None)
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gamma1deg_onoff_softcut.pdf")
    title = "ON/OFF MC (1deg) (Soft cuts)"
    process(path, output, title, CUTS_ONOFF_SOFT)
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gamma1deg_onoff_harshcut.pdf"
    )
    title = "ON/OFF MC (1deg) (Harsh cuts)"
    process(path, output, title, CUTS_ONOFF_HARSH)

    path = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gamma1deg_wobble.h5"
    )
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gamma1deg_wobble_nocut.pdf")
    title = "Wobble MC (1deg) (No cuts)"
    process(path, output, title, None)
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gamma1deg_wobble_cut.pdf")
    title = "Wobble MC (1deg)"
    process(path, output, title, CUTS_WOBBLE)

    path = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gamma1deg_5off_wobble.h5"
    )
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gamma1deg_5off_wobble_nocut.pdf"
    )
    title = "Wobble MC (1deg) (5 OFF) (No cuts)"
    process(path, output, title, None)
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gamma1deg_5off_wobble_cut.pdf"
    )
    title = "Wobble MC (1deg) (5 OFF)"
    process(path, output, title, CUTS_WOBBLE)

    path = get_data(
        "d190918_alpha/extract_alpha_mc/d2019-05-15_simulations_gammaonly_wobble.h5"
    )
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gammaonly_wobble_nocut.pdf")
    title = "Wobble MC (1deg) (No cuts)"
    process(path, output, title, None)
    output = get_plot(
        "d190918_alpha/mc/d2019-05-15_simulations_gammaonly_wobble_cut.pdf")
    title = "Wobble MC (1deg)"
    process(path, output, title, CUTS_WOBBLE)
Exemple #11
0
def main():
    r0_path = get_checs("d181203_erlangen/ac_tf/23deg/Amplitude_600_r0.tio")
    pedestal_path = get_checs(
        "d181203_erlangen/pedestal/Pedestal_23deg_ped.tcal")
    tf_path = get_data("d191122_dc_tf/ac_tf/ac_23deg_tf.h5")

    pedestal = get_pedestal(pedestal_path)
    tf = get_ac_cc_tf(tf_path)

    output_path = get_data("d191122_dc_tf/average_wf.txt")
    process(r0_path, pedestal, tf, output_path)
Exemple #12
0
def main():
    # path = get_data("d191018_alpha/d2019-05-15_simulations_gamma1deg_onoff.h5")
    # output = get_plot("d191018_alpha/optimise_alpha_cut/d2019-05-15_simulations_gamma1deg_onoff_nocut.pdf")
    # title = "ON/OFF MC (1deg) (No cuts)"
    # process(path, output, title, None)
    # output = get_plot("d191018_alpha/optimise_alpha_cut/d2019-05-15_simulations_gamma1deg_onoff_softcut.pdf")
    # title = "ON/OFF MC (1deg) (Soft cuts)"
    # process(path, output, title, CUTS_ONOFF_SOFT)
    # output = get_plot("d191018_alpha/optimise_alpha_cut/d2019-05-15_simulations_gamma1deg_onoff_harshcut.pdf")
    # title = "ON/OFF MC (1deg) (Harsh cuts)"
    # process(path, output, title, CUTS_ONOFF_HARSH)
    #
    # path = get_data("d191018_alpha/d2019-05-15_simulations_gamma1deg_wobble.h5")
    # output = get_plot("d191018_alpha/optimise_alpha_cut/d2019-05-15_simulations_gamma1deg_wobble_nocut.pdf")
    # title = "Wobble MC (1deg) (No cuts)"
    # process(path, output, title, None)
    # output = get_plot("d191018_alpha/optimise_alpha_cut/d2019-05-15_simulations_gamma1deg_wobble_cut.pdf")
    # title = "Wobble MC (1deg)"
    # process(path, output, title, CUTS_WOBBLE)

    path = get_data(
        "d191018_alpha/extract_alpha_mc/d2019-10-03_simulations_gamma1deg_onoff.h5"
    )
    output = get_plot(
        "d191018_alpha/optimise_alpha_cut/d2019-10-03_simulations_gamma1deg_onoff_nocut.pdf"
    )
    title = "ON/OFF MC (1deg) (No cuts)"
    process(path, output, title, None)
    output = get_plot(
        "d191018_alpha/optimise_alpha_cut/d2019-10-03_simulations_gamma1deg_onoff_softcut.pdf"
    )
    title = "ON/OFF MC (1deg) (Soft cuts)"
    process(path, output, title, CUTS_ONOFF_SOFT)
    output = get_plot(
        "d191018_alpha/optimise_alpha_cut/d2019-10-03_simulations_gamma1deg_onoff_harshcut.pdf"
    )
    title = "ON/OFF MC (1deg) (Harsh cuts)"
    process(path, output, title, CUTS_ONOFF_HARSH)

    path = get_data(
        "d191018_alpha/extract_alpha_mc/d2019-10-03_simulations_gamma1deg_wobble.h5"
    )
    output = get_plot(
        "d191018_alpha/optimise_alpha_cut/d2019-10-03_simulations_gamma1deg_wobble_nocut.pdf"
    )
    title = "Wobble MC (1deg) (No cuts)"
    process(path, output, title, None)
    output = get_plot(
        "d191018_alpha/optimise_alpha_cut/d2019-10-03_simulations_gamma1deg_wobble_cut.pdf"
    )
    title = "Wobble MC (1deg)"
    process(path, output, title, CUTS_WOBBLE)
Exemple #13
0
def main():
    paths = dict(
        self=get_data(
            "d191118_pedestal_temperature/d191118/residuals_self.h5"),
        single_31degree=get_data(
            "d191118_pedestal_temperature/d191118/residuals_single_30.h5"),
        lookup=get_data(
            "d191118_pedestal_temperature/d191118/residuals_lookup.h5"),
        interp=get_data(
            "d191118_pedestal_temperature/d191118/residuals_interp.h5"),
        pchip=get_data(
            "d191118_pedestal_temperature/d191118/residuals_pchip.h5"),
    )

    p_mean = MeanVsTemperature()
    p_std = StdVsTemperature()
    p_relstd = RelativeStdVsTemperature()

    with HDF5Reader(paths['self']) as reader:
        df = reader.read("data")
        df = df.set_index("temperature_r0_primary").sort_index()
        ref_std = df['std'].values

    for label, path in paths.items():
        with HDF5Reader(path) as reader:
            df = reader.read("data")
            df = df.set_index("temperature_r0_primary").sort_index()

        temperature = df.index.values
        mean = df['mean'].values
        std = df['std'].values

        p_mean.plot(temperature, mean, label)
        p_std.plot(temperature, std, label)
        p_relstd.plot(temperature, std, ref_std, label)

    p_mean.save(get_plot(f"d191118_pedestal_temperature/d191118/mean.pdf"))
    p_std.save(get_plot(f"d191118_pedestal_temperature/d191118/std.pdf"))
    p_relstd.save(
        get_plot(f"d191118_pedestal_temperature/d191118/rel_std.pdf"))

    with HDF5Reader(paths['self']) as reader:
        df = reader.read("data")
        df = df.set_index("temperature_r0_chamber").sort_index()
        chamber = df.index.values
        primary = df['temperature_r0_primary'].values

    p_temp = TemperatureComparison()
    p_temp.plot(chamber, primary)
    p_temp.save(get_plot(f"d191118_pedestal_temperature/d191118/temp.pdf"))
Exemple #14
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.illumination_profile_path = get_data(
         "d181021_charge_resolution/illumination_profile/d180907_MC.h5"
     )  # TODO: get lab_illumination_profile_correction.h5
     self.dead = [677, 293, 27, 1925, 1955]
     self.calib_class = None
Exemple #15
0
def main():
    d_list = []
    for file in tqdm(all_files):
        tcal_path = file.tcal

        ped_reader = PedestalArrayReader(tcal_path)
        hits_tcal = np.array(ped_reader.GetHits())
        std_tcal = np.array(ped_reader.GetStdDev())

        mask = (hits_tcal < 6) | np.isnan(std_tcal)
        std_tcal = np.ma.masked_array(std_tcal, mask=mask)

        n_noisy = (std_tcal > 5).sum()

        d_list.append(dict(
            name=file.name,
            mean=std_tcal.mean(),
            std=std_tcal.std(),
            min=std_tcal.min(),
            max=std_tcal.max(),
            n_noisy=n_noisy,
        ))

    df = pd.DataFrame(d_list)
    # embed()
    with HDF5Writer(get_data(f"d190730_pedestal/tcal_std.h5")) as w:
        w.write(data=df)
Exemple #16
0
def main():
    runlist_path = get_astri_2019("d2019-05-01_mrk501/runlist.txt")
    directory = dirname(runlist_path)
    df = pd.read_csv(runlist_path, sep='\t')
    paths = [join(directory, f"Run{run:05d}_r1.tio") for run in df['run']]
    output_path = get_data("d190505_dtack/d2019-05-01_mrk501.h5")
    process(paths, output_path)
Exemple #17
0
def process_file(file):
    name = file.__class__.__name__
    input_path = file.r0_path
    output_path = get_data(
        "d181206_pedestal_investigation/cell_info/{}.h5".format(name))
    poi = 10
    process(input_path, output_path, poi)
Exemple #18
0
def process(input_path, function):

    pattern = '(.+)(SN\d{4})(.+)'
    reg_exp = re.search(pattern, input_path)
    sn = reg_exp[2]

    name = function.__name__
    output_path = get_data("d181027_tf_generation/alter_tf/{}_{}.tcal".format(
        name, sn))
    plot_path = get_plot("d181027_tf_generation/alter_tf/{}_{}.pdf".format(
        name, sn))

    print("Reading TF: {}".format(input_path))
    reader = TFArrayReader(input_path)
    tf = np.array(reader.GetTF())
    steps = np.array(reader.GetAdcSteps())

    steps, tf = function(steps, tf)

    print("Writing TF: {}".format(output_path))
    rw = CalibReadWriter()
    rw.WriteTfData(output_path, steps.tolist(), tf, True)

    reader = TFArrayReader(output_path)
    tf = np.array(reader.GetTF())
    steps = np.array(reader.GetAdcSteps())

    p_tf = TFPlot()
    p_tf.plot(steps, tf)
    p_tf.save(plot_path)
Exemple #19
0
def process_file(file):
    readers = file.tio_readers
    name = file.__class__.__name__
    output_path = get_data(
        "d190111_trigger_stability/{}/amplitudes.h5".format(name))
    superpixels = file.spoi
    process(readers, output_path, superpixels)
def main():
    path = get_data("d190717_alpha/wobble.h5")
    with pd.HDFStore(path, mode='r') as store:
        df = store['data']
        mapping = store['mapping']
        with warnings.catch_warnings():
            warnings.simplefilter('ignore', UserWarning)
            mapping.metadata = store.get_storer('mapping').attrs.metadata

    p_camera = CameraMovie(mapping,
                           get_plot("d190717_alpha/wobble_animation/frames"))
    n_row = df.index.size
    for _, row in tqdm(df.iterrows(), total=n_row):
        timestamp = row['timestamp']
        x_src = row['x_src']
        y_src = row['y_src']
        dl1 = row['dl1']
        r1 = row['r1']
        x_cog = row['x_cog']
        y_cog = row['y_cog']
        psi = row['psi']
        p_camera.set_source_position(x_src, y_src)
        p_camera.set_image(dl1)
        # p_camera.set_alpha_line(x_cog, y_cog, psi)
        p_camera.save_frame()
Exemple #21
0
def main():
    # tf_r0_paths = glob(get_checs("d181203_erlangen/dc_tf/externalsync/23deg/*.tio"))
    # pedestal_path = get_checs("d181203_erlangen/pedestal/Pedestal_23deg_ped.tcal")
    # tf_path = get_data("d191122_dc_tf/dc_tf/dc_externalsync_23deg_tf.tcal")
    # tf_class = TFDC
    # process(tf_r0_paths, pedestal_path, tf_path, tf_class)
    #
    # tf_r0_paths = glob(get_checs("d181203_erlangen/dc_tf/externalsync/40deg/*.tio"))
    # pedestal_path = get_checs("d181203_erlangen/pedestal/Pedestal_40deg_ped.tcal")
    # tf_path = get_data("d191122_dc_tf/dc_tf/dc_externalsync_40deg_tf.tcal")
    # tf_class = TFDC
    # process(tf_r0_paths, pedestal_path, tf_path, tf_class)
    #
    # tf_r0_paths = glob(get_checs("d181203_erlangen/dc_tf/hardsync/23deg/*.tio"))
    # pedestal_path = get_checs("d181203_erlangen/pedestal/Pedestal_23deg_ped.tcal")
    # tf_path = get_data("d191122_dc_tf/dc_tf/dc_hardsync_23deg_tf.tcal")
    # tf_class = TFDC
    # process(tf_r0_paths, pedestal_path, tf_path, tf_class)
    #
    # tf_r0_paths = glob(get_checs("d181203_erlangen/dc_tf/hardsync/40deg/*.tio"))
    # pedestal_path = get_checs("d181203_erlangen/pedestal/Pedestal_40deg_ped.tcal")
    # tf_path = get_data("d191122_dc_tf/dc_tf/dc_hardsync_40deg_tf.tcal")
    # tf_class = TFDC
    # process(tf_r0_paths, pedestal_path, tf_path, tf_class)

    tf_r0_paths = glob(
        get_checs("d181203_erlangen/ac_tf/23deg/Amplitude_*.tio"))
    pedestal_path = get_checs(
        "d181203_erlangen/pedestal/Pedestal_23deg_ped.tcal")
    tf_path = get_data("d191122_dc_tf/ac_tf/ac_23deg_tf.h5")
    tf_class = TFACCrossCorrelation
    process(tf_r0_paths, pedestal_path, tf_path, tf_class)
def main():
    r1_paths = dict(
        off=get_astri_2019("d2019-05-08_ledflashers_dynrange/Run13268_r1.tio"),
        on_50=get_astri_2019("d2019-05-08_ledflashers_dynrange/Run13272_r1.tio"),
        on_3=get_astri_2019("d2019-05-08_ledflashers_dynrange/Run13267_r1.tio")
    )
    output = get_data("d190520_charge_extraction/data/charge.h5")
    poi = 2004

    reader = ReaderR1(list(r1_paths.values())[0])
    kw = dict(
        n_pixels=reader.n_pixels,
        n_samples=reader.n_samples,
        mapping=reader.mapping,
        reference_pulse_path=reader.reference_pulse_path,
    )
    extractors = dict(
        cc_nn=(CrossCorrelationNeighbour(**kw), 'charge_cc_nn'),
    )
    for width in range(1, 15):
        extractors[f'sliding_{width}'] = (
            SlidingWindowNeighbour(**kw, window_size=width),
            "charge_sliding_nn"
        )

        for shift in range(-3, 8):
            extractors[f'peak_{width}_{shift}'] = (
                CtapipeNeighbourPeakIntegrator(
                    **kw, window_size=width, window_shift=shift
                ), "charge_nn"
            )

    with HDF5Writer(output) as writer:
        for key, path in r1_paths.items():
            reader = ReaderR1(path, max_events=500)
            baseline_subtractor = BaselineSubtractor(reader)
            time_calibrator = TimeCalibrator()

            desc = "Looping over file"
            for wfs in tqdm(reader, total=reader.n_events, desc=desc):
                iev = wfs.iev
                if reader.stale.any():
                    continue

                wfs = time_calibrator(wfs)
                wfs = baseline_subtractor.subtract(wfs)

                global_params = dict(
                    key=key,
                    iev=iev,
                    pixel=poi,
                )

                for name, (extractor, column) in extractors.items():
                    params = global_params.copy()
                    params['extractor'] = name
                    params['charge'] = extractor.process(wfs)[column][poi]
                    df = pd.DataFrame(params, index=[0])
                    writer.append(df, key='data')
def process_file(file):
    name = file.__class__.__name__
    input_path = get_data(
        "d181206_pedestal_investigation/cell_info/{}.h5".format(name))
    output_path = get_plot(
        "d181206_pedestal_investigation/cell_adc_vs_position/{}/{}.pdf".format(
            name, "{}"))
    process(input_path, output_path)
Exemple #24
0
def main():
    with HDF5Reader(get_data("d190730_pedestal/tcal_std.h5")) as r:
        df = r.read("data").iloc[2:]

    p_std = ComparisonPlotter()
    p_std.plot(df['name'].values, df['mean'].values, df['std'].values,
               df['max'].values)
    p_std.save(get_plot("d190730_pedestal/tcal_std.pdf"))
def main():
    x_checs, y_checs = np.loadtxt(get_data("d181031_sst_rfi/pde/CHECS.dat"),
                                  unpack=True)
    x_prod3, y_prod3 = np.loadtxt(get_data("d181031_sst_rfi/pde/Prod3.dat"),
                                  unpack=True)
    x_prod4, y_prod4 = np.loadtxt(get_data("d181031_sst_rfi/pde/Prod4.dat"),
                                  unpack=True)

    integral_checs = np.trapz(y_checs, x_checs)
    integral_prod3 = np.trapz(y_prod3, x_prod3)
    print(integral_checs / integral_prod3)

    p_pde = PDEPlotter()
    p_pde.plot(x_checs, y_checs, label="CHEC-S")
    p_pde.plot(x_prod3, y_prod3, label="Prod3")
    p_pde.plot(x_prod4, y_prod4, label="Prod4")
    p_pde.save(get_plot("d181031_sst_rfi/pde.pdf"))
Exemple #26
0
def main():
    r0_paths = glob(
        get_checs("d191118_pedestal_temperature/data/d191118/*.tio"))
    pedestal_paths = glob(
        get_checs("d191118_pedestal_temperature/lookup/*_ped.tcal"))
    output_path = get_data(
        f"d191118_pedestal_temperature/d191118/residuals_pchip.h5")
    process(r0_paths, pedestal_paths, output_path)
Exemple #27
0
def main():
    path = get_data(f"d191118_pedestal_temperature/d191118/adc_vs_temperature.h5")

    with HDF5Reader(path) as reader:
        df = reader.read("data")
        df = df.set_index("temperature").sort_index()

    temperature = df.index.values
    delta_mean = df['delta_mean'].values
    delta_std = df['delta_std'].values
    delta_channel_mean = df['delta_channel_mean'].values
    delta_channel_std = df['delta_channel_std'].values
    spead_mean = df['spread_mean'].values
    spread_std = df['spread_std'].values

    p_delta = ValueVsTemp()
    p_delta.plot(temperature, delta_mean, delta_std, "TM")
    p_delta.plot(temperature, delta_channel_mean, delta_channel_std, "Channel 0")
    p_delta.save(get_plot(f"d191118_pedestal_temperature/d191118/delta_vs_temp.pdf"))

    # p_delta = ValueVsTemp()
    # p_delta.plot(temperature, delta_channel_mean, delta_channel_std)
    # p_delta.save(get_plot(f"d191118_pedestal_temperature/d191118/delta_channel_vs_temp.pdf"))

    p_delta = SpreadVsTemp()
    p_delta.plot(temperature, spead_mean, spread_std)
    p_delta.save(get_plot(f"d191118_pedestal_temperature/d191118/spread_vs_temp.pdf"))

    paths = dict(
        d191118_60hz=get_data("d191118_pedestal_temperature/d191118/adc_vs_temperature.h5"),
        d191119_600hz=get_data("d191118_pedestal_temperature/d191119/adc_vs_temperature.h5"),
        d191120_200hz=get_data("d191118_pedestal_temperature/d191120/adc_vs_temperature.h5"),
    )
    p_delta = ValueVsTemp()
    for label, path in paths.items():
        with HDF5Reader(path) as reader:
            df = reader.read("data")
            df = df.set_index("temperature").sort_index()

        temperature = df.index.values
        delta_mean = df['delta_mean'].values
        delta_std = df['delta_std'].values

        p_delta.plot(temperature, delta_mean, delta_std, label)
    p_delta.save(get_plot(f"d191118_pedestal_temperature/delta_vs_temp_vs_day.pdf"))
Exemple #28
0
def process_file(file):
    name = file.__class__.__name__
    input_path = get_data(
        "d190104_vped_pedestal_steps/cell_info/{}.h5".format(name))
    output_dir = get_plot(
        "d190104_vped_pedestal_steps/steps_vs_vped/{}".format(name))
    coi = 12

    process(input_path, output_dir, coi)
Exemple #29
0
def main():
    pedestal_paths = glob(
        get_checs("d191118_pedestal_temperature/data/d191118/*_ped.tcal"))
    output_path = get_data(
        f"d191118_pedestal_temperature/d191118/adc_vs_temperature.h5")
    process(pedestal_paths, output_path)

    pedestal_paths = glob(
        get_checs("d191118_pedestal_temperature/data/d191119/*_ped.tcal"))
    output_path = get_data(
        f"d191118_pedestal_temperature/d191119/adc_vs_temperature.h5")
    process(pedestal_paths, output_path)

    pedestal_paths = glob(
        get_checs("d191118_pedestal_temperature/data/d191120/*_ped.tcal"))
    output_path = get_data(
        f"d191118_pedestal_temperature/d191120/adc_vs_temperature.h5")
    process(pedestal_paths, output_path)
def process_file(file):
    name = file.__class__.__name__
    input_paths = file.r0_paths
    amplitudes = file.amplitudes
    output_path = get_data(
        "d190104_vped_pedestal_steps/cell_info/{}.h5".format(name))
    poi = 10

    assert len(input_paths) > 0

    process_list(input_paths, amplitudes, output_path, poi)