def main():
    # Handle the input arguments:
    ##############################
    args = pmt_parse_arguments()
    input_directory = args.i
    config_file_name = args.c
    output_directory = args.o
    ##############################

    filenames_txt = input_directory + "/filenames.txt"

    try:
        print(">>> Reading data from file: {}".format(filenames_txt))
        date_file = open(filenames_txt, 'r')
    except FileNotFoundError as fnf_error:
        print(fnf_error)
        raise Exception("Error opening data file {}".format(filenames_txt))

    filenames = np.loadtxt(filenames_txt,
                           delimiter=',',
                           dtype={
                               'names': ['filename'],
                               'formats': ['S100']
                           },
                           unpack=True)

    topology = [2, 1]
    pmt_array = PMT_Array(topology, "summary")
    pmt_array.set_pmt_id("GAO607", 0)
    pmt_array.set_pmt_id("GAO612", 1)

    # Set the cuts you wish to apply
    # If you don't do this the defaults are used
    if config_file_name is not None:
        pmt_array.apply_setting(config_file_name)
        print_settings(pmt_array)

    for i_file in tqdm.tqdm(range(filenames.size)):
        file = filenames[i_file][0].decode("utf-8")

        try:
            read_tree(input_directory + "/" + file, pmt_array,
                      output_directory,
                      file.split(".root")[0] + "_output.root")
        except:
            print("error reading file:", input_directory + "/" + file)
Exemplo n.º 2
0
def main():
    # Handle the input arguments:
    ##############################
    args = pmt_parse_arguments()
    input_directory = args.i
    # config_file_name = args.c
    output_directory = args.o
    ##############################

    out_files = [
        output_directory + '/res_vs_time_ch0.txt',
        output_directory + '/res_vs_time_ch1.txt'
    ]
    create_file(out_files[0])
    create_file(out_files[1])

    filenames_txt = input_directory + "/filenames.txt"

    try:
        print(">>> Reading data from file: {}".format(filenames_txt))
        date_file = open(filenames_txt, 'r')
    except FileNotFoundError as fnf_error:
        print(fnf_error)
        raise Exception("Error opening data file {}".format(filenames_txt))

    filenames = np.loadtxt(filenames_txt,
                           delimiter=',',
                           dtype={
                               'names': ['filename'],
                               'formats': ['S100']
                           },
                           unpack=True)

    topology = [2, 1]
    pmt_array = PMT_Array(topology, "summary")
    pmt_array.set_pmt_id("GAO607", 0)
    pmt_array.set_pmt_id("GAO612", 1)
    '''# Set the cuts you wish to apply
    # If you don't do this the defaults are used
    if config_file_name is not None:
        pmt_array.apply_setting(config_file_name)
        # print_settings(pmt_array)'''

    # Set up the containers for the summary
    resolutions = [[] for i in range(pmt_array.get_pmt_total_number())]
    resolutions_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    dates = [[] for i in range(pmt_array.get_pmt_total_number())]
    gains = [[] for i in range(pmt_array.get_pmt_total_number())]
    gains_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    baseline_means = [[] for i in range(pmt_array.get_pmt_total_number())]
    baseline_sigs = [[] for i in range(pmt_array.get_pmt_total_number())]
    fit_chi2 = [[] for i in range(pmt_array.get_pmt_total_number())]

    for i_file in tqdm.tqdm(range(filenames.size)):
        file = filenames[i_file][0].decode("utf-8")

        date = file.split("_")[0]
        voltage = int(file.split("_")[1].split("A")[1])

        if voltage == 1000:
            pass
        else:
            continue

        fit_parameters = read_file(date, voltage, input_directory + "/" + file,
                                   pmt_array, output_directory)

        for i_om in range(pmt_array.get_pmt_total_number()):

            if len(fit_parameters[i_om]) > 0:
                pass
            else:
                continue

            mu = fit_parameters[i_om][0]["mu"]
            mu_err = fit_parameters[i_om][0]["mu_err"]
            sig = fit_parameters[i_om][0]["sig"]
            sig_err = fit_parameters[i_om][0]["sig_err"]
            chi_2 = fit_parameters[i_om][0]["chi2"]
            gain = fit_parameters[i_om][0]["gain"]
            baseline_mean = fit_parameters[i_om][0]["base_mu"]
            baseline_sig = fit_parameters[i_om][0]["base_sig"]

            res, res_err = get_resolution(mu, mu_err, sig, sig_err)

            resolutions[i_om].append(res)
            resolutions_err[i_om].append(res_err)
            dates[i_om].append(int(date))
            gains[i_om].append(gain)
            baseline_means[i_om].append(baseline_mean)
            baseline_sigs[i_om].append(baseline_sig)
            fit_chi2[i_om].append(chi_2)

            write_to_file(
                out_files[i_om],
                '{},{},{},{},{}'.format(date, res, res_err, chi_2, gain))

    # Plot individual summaries
    for i_om in range(pmt_array.get_pmt_total_number()):

        if len(resolutions[i_om]) > 0:
            pass
        else:
            continue
        date = process_date(dates[i_om])

        try:
            start = np.where(date == 0)[0][0]
        except:
            start = np.where(date == 1)[0][0]
        mid = np.where(date == 98)[0][0]

        # print("start:",start)

        plt.plot(date[:start + 1],
                 np.array(gains[i_om][:start + 1]) * 2,
                 "g.",
                 label="Atmospheric He")
        plt.plot(date[start + 1:mid + 1],
                 np.array(gains[i_om][start + 1:mid + 1]) * 2,
                 "b.",
                 label="1% He")
        plt.plot(date[mid + 1:],
                 np.array(gains[i_om][mid + 1:]) * 2,
                 "r.",
                 label="10% He")
        plt.axvline(date[start], 0, 100, ls='--', color='k')
        plt.axvline(date[mid], 0, 100, ls='--', color='k')
        plt.xlabel("exposure days relative to 190611")
        plt.ylabel("PMT gain at 1Mev /mV")
        plt.title(
            pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
            " Gain at 1MeV vs exposure time")
        plt.grid()
        plt.ylim(150, 300)
        plt.legend(loc='lower right')
        plt.savefig(output_directory + "/summary_plots/" +
                    pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
                    "_gains_vs_time.png")
        plt.close()

        plt.errorbar(date,
                     baseline_means[i_om],
                     yerr=baseline_sigs[i_om],
                     fmt='k.-',
                     ecolor='r')
        plt.grid()
        plt.xlabel("exposure days relative to 190611")
        plt.ylabel("Baseline mean /mV")
        plt.title(
            pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
            " Baseline mean vs exposure time")
        plt.savefig(output_directory + "/summary_plots/" +
                    pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
                    "_baseline_mean_vs_time.png")

        plt.close()
        '''plt.plot(date, baseline_sigs[i_om])
        plt.xlabel("exposure days relative to 190611")
        plt.ylabel("Baseline std-dev")
        plt.title(pmt_array.get_pmt_object_number(i_om).get_pmt_id() + " Baseline std-dev vs exposure time")
        plt.savefig(output_directory + "/summary_plots/" +
                    pmt_array.get_pmt_object_number(i_om).get_pmt_id() + "_baseline_sigma_vs_time")
        plt.close()'''

        res_filter = []
        for i_date in range(len(date)):
            if 1 < resolutions[i_om][i_date] < 3.75 and fit_chi2[i_om][
                    i_date] < 10:
                res_filter.append(True)
            else:
                res_filter.append(False)

        popt, pcov = curve_fit(
            linear,
            np.array(date[start:])[res_filter[start:]],
            np.array(resolutions[i_om][start:])[res_filter[start:]],
            sigma=np.array(resolutions_err[i_om][start:])[res_filter[start:]],
            p0=[0.001, 2],
            bounds=[[0, 0], [0.002, 3.5]],
            maxfev=500000)
        x_array = np.linspace(date[start], np.amax(date), 2)
        chi_2 = chi2(
            np.array(resolutions[i_om][start:])[res_filter[start:]],
            np.array(resolutions_err[i_om][start:])[res_filter[start:]],
            linear(date[start:][res_filter[start:]], *popt), len(popt))

        plt.errorbar(date[:start + 1],
                     resolutions[i_om][:start + 1],
                     yerr=resolutions_err[i_om][:start + 1],
                     fmt="g.",
                     label="Atmospheric He")
        plt.plot(np.array(date[start:])[res_filter[start:]],
                 np.array(resolutions[i_om][start:])[res_filter[start:]],
                 'ko',
                 label="used values")
        plt.errorbar(date[start + 1:mid + 1],
                     resolutions[i_om][start + 1:mid + 1],
                     yerr=resolutions_err[i_om][start + 1:mid + 1],
                     fmt="b.",
                     label="1% He")
        plt.errorbar(date[mid + 1:],
                     resolutions[i_om][mid + 1:],
                     yerr=resolutions_err[i_om][mid + 1:],
                     fmt="r.",
                     label="10% He")
        plt.plot(x_array, linear(x_array, *popt), 'k-')
        plt.xlabel(
            "exposure days relative to 190611 \n $y = (${:.1e}$ ± ${:.0e})$x + (${:.1e}$ ± ${:.0e}$)$ $\chi^2_R = {:.2}$"
            .format(popt[0], np.sqrt(pcov[0, 0]), popt[1], np.sqrt(pcov[1, 1]),
                    chi_2))
        plt.ylabel("Resolution at 1MeV /% $\sigma / \mu$")
        plt.title(
            pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
            " Resolution vs exposure time")
        plt.axvline(date[start], 0, 100, ls='--', color='k')
        plt.axvline(date[mid], 0, 100, ls='--', color='k')
        plt.grid()
        plt.ylim(2, 4.5)
        plt.xlim(np.amin(date), np.amax(date))
        plt.legend(loc='upper right')
        plt.tight_layout()
        plt.savefig(output_directory + "/summary_plots/" +
                    pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
                    "_resolution_vs_time.png")
        plt.close()

        plt.plot(np.array(date[start:])[res_filter[start:]],
                 np.array(fit_chi2[i_om][start:])[res_filter[start:]],
                 'ko',
                 label="used values")
        plt.plot(date[:start + 1],
                 fit_chi2[i_om][:start + 1],
                 "g.",
                 label="Atmospheric He")
        plt.plot(date[start + 1:mid + 1],
                 fit_chi2[i_om][start + 1:mid + 1],
                 "b.",
                 label="1% He")
        plt.plot(date[mid + 1:],
                 fit_chi2[i_om][mid + 1:],
                 "r.",
                 label="10% He")
        plt.xlabel("exposure days relative to 190611")
        plt.ylabel("$\chi^2_R$")
        plt.title(
            pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
            " Resolution fit $\chi^2_R$ vs exposure time")
        plt.grid()
        plt.axvline(date[start], 0, 100, ls='--', color='k')
        plt.axvline(date[mid], 0, 100, ls='--', color='k')
        plt.legend(loc='upper right')
        plt.xlim(np.amin(date), np.amax(date))
        plt.ylim(0, 10)
        plt.tight_layout()
        plt.savefig(output_directory + "/summary_plots/" +
                    pmt_array.get_pmt_object_number(i_om).get_pmt_id() +
                    "_resolution_vs_time_chi2.png")
        plt.close()

    # Plot ratio
    x_date = []
    ratio = []
    ratio_err = []
    gain_ratio = []
    for i in range(len(dates[0])):
        for j in range(len(dates[1])):
            if dates[0][i] == dates[1][j]:
                x_date.append(dates[0][i])
                ratio.append(resolutions[0][i] / resolutions[1][j])
                ratio_err.append(
                    resolutions[0][i] / resolutions[1][j] *
                    np.sqrt((resolutions_err[0][i] / resolutions[0][i])**2 +
                            (resolutions_err[1][j] / resolutions[1][j])**2))
                gain_ratio.append(gains[0][i] / gains[1][j])
                break

    popt, pcov = curve_fit(linear,
                           x_date,
                           ratio,
                           sigma=ratio_err,
                           p0=[1, 1],
                           bounds=[[0, 0], [10, 10]])
    x_date = process_date(x_date)
    x_array = np.linspace(np.amin(x_date), np.amax(x_date), 2)
    chi_2 = chi2(ratio, ratio_err, linear(x_date, *popt), 2)

    plt.errorbar(x_date, ratio, yerr=ratio_err, fmt="k.")
    plt.plot(
        x_array,
        linear(x_array, *popt),
        "g-",
        label=
        "$y = (${:.1e}$ ± ${:.0e})$\\times x + (${:.1e}$ ± ${:.0e}$) \chi^2_R = {:.2}$"
        .format(popt[0], np.sqrt(pcov[0, 0]), popt[1], np.sqrt(pcov[1, 1]),
                chi_2))
    plt.axvline(98, color="r", ls="--")
    plt.axvline(0, color="b", ls="--")
    plt.xlabel("exposure days relative to 190611")
    plt.ylabel("Ratio res_Ch0/res_Ch1")
    plt.title("Ratio of resolution of CH 0 & 1 vs time")
    plt.grid()
    plt.xlim(np.amin(np.array(x_date)), np.amax(np.array(x_date)))
    plt.ylim(0, 2)
    plt.savefig(output_directory +
                "/summary_plots/resolution_ratio_vs_time.png")
    plt.close()

    plt.plot(x_date, gain_ratio, "k.")
    plt.axvline(98, color="r", ls="--")
    plt.axvline(0, color="b", ls="--")
    plt.xlabel("exposure days relative to 190611")
    plt.ylabel("Ratio gain_Ch0/gain_Ch1")
    plt.title("Ratio of gain of CH 0 & 1 vs time")
    plt.grid()
    plt.xlim(np.amin(np.array(x_date)), np.amax(np.array(x_date)))
    plt.ylim(0.7, 1)
    plt.savefig(output_directory + "/summary_plots/gain_ratio_vs_time.png")
    plt.close()

    print("<<<< FINISHED >>>")
Exemplo n.º 3
0
def main():
    # Handle the input arguments:
    ##############################
    args = pmt_parse_arguments()
    input_directory = args.i
    # config_file_name = args.c
    output_directory = args.o
    ##############################

    filenames_txt = input_directory + "/filenames.txt"

    try:
        print(">>> Reading data from file: {}".format(filenames_txt))
        date_file = open(filenames_txt, 'r')
    except FileNotFoundError as fnf_error:
        print(fnf_error)
        raise Exception("Error opening data file {}".format(filenames_txt))

    filenames = np.loadtxt(filenames_txt, delimiter=',', dtype={
        'names': ['filename'],
        'formats': ['S100']}, unpack=True)

    topology = [2, 1]
    pmt_array = PMT_Array(topology, "summary")
    pmt_array.set_pmt_id("GAO607", 0)
    pmt_array.set_pmt_id("GAO612", 1)

    '''# Set the cuts you wish to apply
    # If you don't do this the defaults are used
    if config_file_name is not None:
        pmt_array.apply_setting(config_file_name)
        # print_settings(pmt_array)'''

    # Set up the containers for the summary
    apulse_rates = [[] for i in range(pmt_array.get_pmt_total_number())]
    apulse_rates_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    he_apulse_rates = [[] for i in range(pmt_array.get_pmt_total_number())]
    he_apulse_rates_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    dates = [[] for i in range(pmt_array.get_pmt_total_number())]

    out_files = [output_directory+'/apulse_num_ch0.txt', output_directory+'/apulse_num_ch1.txt']
    create_file(out_files[0])
    create_file(out_files[1])

    for i_file in tqdm.tqdm(range(filenames.size)):
        file = filenames[i_file][0].decode("utf-8")

        date = file.split("_")[0]
        voltage = int(file.split("_")[1].split("A")[1])

        if voltage == 1400:
            pass
        else:
            continue

        apulse_info = read_file(date, voltage, input_directory + "/" + file, pmt_array, output_directory)

        for i_om in range(pmt_array.get_pmt_total_number()):

            if len(apulse_info[i_om]) > 0:
                pass
            else:
                continue

            apulse_rate = apulse_info[i_om][0]["apulse_rate"]
            he_apulse_rate = apulse_info[i_om][0]["he_apulse_rate"]

            apulse_rate_err = apulse_info[i_om][0]["apulse_rate_err"]
            he_apulse_rate_err = apulse_info[i_om][0]["he_apulse_rate_err"]


            apulse_rates[i_om].append(apulse_rate)
            apulse_rates_err[i_om].append(apulse_rate_err/10)
            he_apulse_rates[i_om].append(he_apulse_rate)
            he_apulse_rates_err[i_om].append(he_apulse_rate_err/10)
            dates[i_om].append(int(date))

            write_to_file(out_files[i_om], '{},{},{},{},{}'.format(date, apulse_rate, apulse_rate_err, he_apulse_rate, he_apulse_rate_err))

    # Plot individual summaries
    for i_om in range(pmt_array.get_pmt_total_number()):

        if len(apulse_rates[i_om]) > 0:
            pass
        else:
            continue
        date = process_date(dates[i_om])

        try:
            start = np.where(date == 0)[0][0]
        except:
            start = np.where(date == 1)[0][0]
        mid = np.where(date == 98)[0][0]

        print(date)

        print("start:", start)

        plt.figure(num=None, figsize=(9, 5), dpi=80, facecolor='w', edgecolor='k')
        plt.errorbar(date[:start + 1], np.array(apulse_rates[i_om][:start + 1]), yerr=np.array(apulse_rates_err[i_om][:start + 1]),
                 fmt="g.", label="Atmospheric He")
        plt.errorbar(date[start+1:mid + 1], np.array(apulse_rates[i_om][start+1:mid + 1]), yerr=np.array(apulse_rates_err[i_om][start+1:mid + 1]),
                 fmt="b.", label="1% He")
        plt.errorbar(date[mid+1:], np.array(apulse_rates[i_om][mid+1:]), yerr=np.array(apulse_rates_err[i_om][mid+1:]),
                 fmt="r.", label="10% He")
        plt.axvline(date[start], 0, 100, ls='--', color='k')
        plt.axvline(date[mid], 0, 100, ls='--', color='k')
        plt.xlabel("exposure days relative to 191106")
        plt.ylabel("Afterpulse rate /%")
        plt.title(pmt_array.get_pmt_object_number(i_om).get_pmt_id() + " afterpulse rate vs exposure time")
        plt.grid()
        plt.ylim(10,90)
        plt.legend(loc='upper left')
        plt.savefig(output_directory + "/summary_plots/" +
                    pmt_array.get_pmt_object_number(i_om).get_pmt_id() + "_apulse_rate_vs_time")
        plt.close()

        plt.figure(num=None, figsize=(9, 5), dpi=80, facecolor='w', edgecolor='k')
        plt.errorbar(date[:start + 1], np.array(he_apulse_rates[i_om][:start + 1]), yerr=np.array(he_apulse_rates_err[i_om][:start + 1]),
                 fmt="g.", label="Atmospheric He")
        plt.errorbar(date[start + 1:mid + 1], np.array(he_apulse_rates[i_om][start + 1:mid + 1]), yerr=np.array(he_apulse_rates_err[i_om][start + 1:mid + 1]),
                 fmt="b.", label="1% He")
        plt.errorbar(date[mid + 1:], np.array(he_apulse_rates[i_om][mid + 1:]), yerr=np.array(he_apulse_rates_err[i_om][mid + 1:]),
                 fmt="r.", label="10% He")
        plt.axvline(date[start], 0, 100, ls='--', color='k')
        plt.axvline(date[mid], 0, 100, ls='--', color='k')
        plt.xlabel("exposure days relative to 191106")
        plt.ylabel("Normalised apulse number")
        plt.title(pmt_array.get_pmt_object_number(i_om).get_pmt_id() + " afterpulse rate vs exposure time")
        plt.grid()
        # plt.ylim(150,300)
        plt.legend(loc='lower right')
        plt.savefig(output_directory + "/summary_plots/" +
                    pmt_array.get_pmt_object_number(i_om).get_pmt_id() + "_he_apulse_rate_vs_time")
        plt.close()

    # Plot ratio
    x_date = []
    ratio = []
    ratio_err = []
    gain_ratio = []
    he_ratio = []
    he_ratio_err = []
    for i in range(len(dates[0])):
        for j in range(len(dates[1])):
            if dates[0][i] == dates[1][j]:
                x_date.append(dates[0][i])

                if apulse_rates[1][j] == 0:
                    pass
                else:
                    ratio.append(apulse_rates[0][i] / apulse_rates[1][j])

                if he_apulse_rates[1][j] == 0:
                    pass
                else:
                    he_ratio.append(he_apulse_rates[0][i] / he_apulse_rates[1][j])

                break

    x_date = process_date(x_date)

    plt.plot(x_date, ratio, "k.")
    plt.axvline(98, color="r", ls="--")
    plt.axvline(0, color="b", ls="--")
    plt.xlabel("exposure days relative to 191106")
    plt.ylabel("Ratio apulse rate Ch0/Ch1")
    plt.title("Ratio of after pulse rates of CH 0 & 1 vs time")
    plt.grid()
    #plt.xlim(np.amin(np.array(x_date)), np.amax(np.array(x_date)))
    #plt.ylim(0, 2)
    plt.savefig(output_directory + "/summary_plots/apulse_rate_ratio_vs_time")
    plt.close()

    plt.plot(x_date, he_ratio, "k.")
    plt.axvline(98, color="r", ls="--")
    plt.axvline(0, color="b", ls="--")
    plt.xlabel("exposure days relative to 191106")
    plt.ylabel("Ratio apulse rate Ch0/Ch1")
    plt.title("Ratio of after pulse rates of CH 0 & 1 vs time")
    plt.grid()
    #plt.xlim(np.amin(np.array(x_date)), np.amax(np.array(x_date)))
    # plt.ylim(0, 2)
    plt.savefig(output_directory + "/summary_plots/he_apulse_rate_ratio_vs_time")
    plt.close()
Exemplo n.º 4
0
def main():
    # Handle the input arguments:
    ##############################
    args = pmt_parse_arguments()
    input_directory = args.i
    run_id = args.c
    # config_file_name = args.c
    output_directory = args.o
    ##############################

    filenames_txt = input_directory + "/filenames.txt"

    try:
        print(">>> Reading data from file: {}".format(filenames_txt))
        date_file = open(filenames_txt, 'r')
    except FileNotFoundError as fnf_error:
        print(fnf_error)
        raise Exception("Error opening data file {}".format(filenames_txt))

    filenames = np.loadtxt(filenames_txt,
                           delimiter=',',
                           dtype={
                               'names': ['filename'],
                               'formats': ['S100']
                           },
                           unpack=True)

    topology = [2, 1]
    pmt_array = PMT_Array(topology, run_id + "summary")
    pmt_array.set_pmt_id("GAO607", 0)
    pmt_array.set_pmt_id("GAO612", 1)

    # Set up the containers for the summary
    par = [[] for i in range(pmt_array.get_pmt_total_number())]
    par_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    par_he = [[] for i in range(pmt_array.get_pmt_total_number())]
    par_he_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    aan = [[] for i in range(pmt_array.get_pmt_total_number())]
    aan_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    aan_he = [[] for i in range(pmt_array.get_pmt_total_number())]
    aan_he_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    ap_charge = [[] for i in range(pmt_array.get_pmt_total_number())]
    ap_charge_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    he_ap_charge = [[] for i in range(pmt_array.get_pmt_total_number())]
    he_ap_charge_err = [[] for i in range(pmt_array.get_pmt_total_number())]
    ratios = [[] for i in range(pmt_array.get_pmt_total_number())]
    he_ratios = [[] for i in range(pmt_array.get_pmt_total_number())]
    dates = [[] for i in range(pmt_array.get_pmt_total_number())]

    for i_file in tqdm.tqdm(range(filenames.size)):
        file = filenames[i_file][0].decode("utf-8")

        date = file.split("_")[0]
        voltage = int(file.split("_")[1].split("A")[1])

        if voltage == 1400:
            pass
        else:
            continue

        apulse_info = read_file(date, voltage, input_directory + "/" + file,
                                pmt_array, output_directory)

        for i_om in range(pmt_array.get_pmt_total_number()):

            if len(apulse_info[i_om]) > 0:
                pass
            else:
                continue

            i_par = apulse_info[i_om][0]["par"]
            i_par_he = apulse_info[i_om][0]["par_he"]
            i_par_err = apulse_info[i_om][0]["par_err"]
            i_par_he_err = apulse_info[i_om][0]["par_he_err"]

            i_aan = apulse_info[i_om][0]["aan"]
            i_aan_he = apulse_info[i_om][0]["aan_he"]
            i_aan_err = apulse_info[i_om][0]["aan_err"]
            i_aan_he_err = apulse_info[i_om][0]["aan_he_err"]
            i_ap_charge = apulse_info[i_om][0]["ap_charge"]
            i_ap_charge_err = apulse_info[i_om][0]["ap_charge_err"]
            i_he_ap_charge = apulse_info[i_om][0]["he_ap_charge"]
            i_he_ap_charge_err = apulse_info[i_om][0]["he_ap_charge_err"]
            i_ratio = apulse_info[i_om][0]["ratio"]
            i_he_ratio = apulse_info[i_om][0]["he_ratio"]

            par[i_om].append(i_par)
            par_err[i_om].append(i_par_err / 10)
            par_he[i_om].append(i_par_he)
            par_he_err[i_om].append(i_par_he_err / 10)
            aan[i_om].append(i_aan)
            aan_err[i_om].append(i_aan_err)
            aan_he[i_om].append(i_aan_he)
            aan_he_err[i_om].append(i_aan_he_err)
            ap_charge[i_om].append(i_ap_charge)
            ap_charge_err[i_om].append(i_ap_charge_err)
            he_ap_charge[i_om].append(i_he_ap_charge)
            he_ap_charge_err[i_om].append(i_he_ap_charge_err)
            ratios[i_om].append(i_ratio)
            he_ratios[i_om].append(i_he_ratio)

            dates[i_om].append(int(date))

    plot_ap_charge(dates, ap_charge, output_directory, "_" + run_id)
    plot_ap_charge(dates, he_ap_charge, output_directory, "_he_" + run_id)
    plot_aan(dates, aan, output_directory, "_" + run_id)
    plot_aan(dates, aan_he, output_directory, "_he_" + run_id)
    plot_aapc_vs_charge(dates, ratios, output_directory, "_" + run_id)
    plot_aapc_vs_charge(dates, he_ratios, output_directory, "_he_" + run_id)
    '''plot_par_ratio(dates, par, output_directory, "_" + run_id)