コード例 #1
0
def load_and_plot_results():
    # %% Plot and save as PDF
    # This set subsequent plots to the glotaran style
    plot_style = PlotStyle()
    plt.rc("axes", prop_cycle=plot_style.cycler)

    parameter_file = output_folder.joinpath("optimized_parameters.csv")
    parameters = read_parameters_from_csv_file(str(parameter_file))
    print(f"Optimized parameters loaded:\n {parameters}")

    result1 = output_folder.joinpath("dataset1.nc")
    fig1 = plot_overview(result1, linlog=True, show_data=True)
    timestamp = datetime.today().strftime("%y%m%d_%H%M")
    fig1.savefig(output_folder.joinpath(f"plot_overview_1of2_{timestamp}.pdf"),
                 bbox_inches="tight")

    result2 = output_folder.joinpath("dataset2.nc")
    fig2 = plot_overview(result2, linlog=True)
    timestamp = datetime.today().strftime("%y%m%d_%H%M")
    fig2.savefig(output_folder.joinpath(f"plot_overview_2of2_{timestamp}.pdf"),
                 bbox_inches="tight")
    plt.show()
コード例 #2
0
data_path2 = script_folder.joinpath("equareaIRFsim6.ascii")
dataset2 = gta.io.read_data_file(data_path2)
# print(dataset2)
data_path3 = script_folder.joinpath("equareaIRFsim8.ascii")
dataset3 = gta.io.read_data_file(data_path3)
# model inlezen + parameters
model_path = script_folder.joinpath("model.yml")
parameters_path = script_folder.joinpath("parameters.yml")

model = gta.read_model_from_yaml_file(model_path)

# if the optimized parameters from a previous run are available, use those
parameter_file = output_folder.joinpath("optimized_parameters.csv")
if parameter_file.exists():
    print("Optimized parameters exists: please check")
    parameters = read_parameters_from_csv_file(str(parameter_file))
else:
    parameters = gta.read_parameters_from_yaml_file(parameters_path)

print(model.validate(parameters=parameters))

# define the analysis scheme to optimize
scheme = Scheme(
    model,
    parameters,
    {
        "dataset1": dataset1,
        "dataset2": dataset2,
        "dataset3": dataset3
    },
    maximum_number_function_evaluations=99,