def save_nlhmo_test():
    points = generate_harmonic_oscillator_nonlinear_points()

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points, 33,
                                                     38)
    test_derivations(planes, harmonic_nonlinear_oscillator_calc, verbose=True)
    plane_creator.write_plane(planes, './chosen_datasets/nlhmo_33_38')
def linear_test(low, high):
    points = generate_linear_points1(1000, 1, 5)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, calc_func, verbose=False)
    return error
def harmonic_oscillator_test(low, high):
    points = generate_harmonic_oscillator_points(1000, 0, 10)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, harmonic_oscillator_calc, verbose=False)
    return error
def hyperbola_test(low, high):
    points = generate_hyperbola_points(500, 1, 10)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, hyperbola_calc, verbose=False)
    return error
def save_hyperbola():
    points = generate_hyperbola_points(1250, 1, 10)
    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     100, 150)
    test_derivations(planes, hyperbola_calc, verbose=False)
    plane_creator.write_plane(
        planes,
        './chosen_datasets/hyperbolthree - 0.1 * two + 9.8 * sin(one)a_1.5_100_150'
    )
def save_sphere():
    radius = 5
    points = DataSet(generate_sphere(radius, 30))
    sphere_func = sphere_calc_func(radius, 0, 0, 0)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     250, 300)
    test_derivations(planes, sphere_func, verbose=False)
    plane_creator.write_plane(planes, './chosen_datasets/sphere_5_0_0_250_300')
def save_gauss_function_test():
    points = DataSet.import_dataset(
        './datasets/Feynman_with_units/cut/I.6.2a-1000')

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     200, 220)
    test_derivations(planes, calc_1_6_20_a, verbose=True)
    plane_creator.write_plane(planes, './chosen_datasets/gauss_200_220')
    DataSet.write_dataset(points, './chosen_points_datasets/gauss_200_220')
def gauss_function_test(low, high):
    points = DataSet.import_dataset(
        './datasets/Feynman_with_units/cut/I.6.2a-1000')

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, calc_1_6_20_a, verbose=False)
    return error
def only_points_dataset(low, high):
    points = DataSet.import_dataset('./datasets/Feynman_with_units/cut/I.18.4')
    calc_func = calc_1_18_4

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, calc_func, verbose=False)
    return error
def save_circle():
    r, xc, yc = 4, 0, 0
    points = generate_circle_points(1000, r, xc, yc)
    func = circle_func(r, xc, yc)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     100, 150)
    test_derivations(planes, func, verbose=False)
    plane_creator.write_plane(planes, './chosen_datasets/circle_4_0_0_100_150')
def save_ellipse():
    ra, rb, xc, yc = 3, 4, 1, 2
    points = generate_ellipse_points(1000, ra, rb, xc, yc)
    func = ellipse_func(ra, rb, xc, yc)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     150, 200)
    test_derivations(planes, func, verbose=False)
    plane_creator.write_plane(planes,
                              './chosen_datasets/ellipse_1_2_3_4_150_200')
def moved_ellipse_test(low, high):
    ra, rb, xc, yc = 2.5, 5, 3, 4.5
    points = generate_ellipse_points(1000, ra, rb, xc, yc)
    func = ellipse_func(ra, rb, xc, yc)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, func, verbose=False)
    return error
def sphere_test(low, high):
    radius = 5
    points = DataSet(generate_sphere(radius, 20))
    sphere_func = sphere_calc_func(radius, 0, 0, 0)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, sphere_func, verbose=False)
    return error
def circle_moved_test(low, high):
    r, xc, yc = 6, 1, 2
    points = generate_circle_points(1000, r, xc, yc)
    func = circle_func(r, xc, yc)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     low, high)
    #plot_kernel_with_dataset3D(points)
    error = test_derivations(planes, func, verbose=False)
    return error
def save_moved_circle():
    r, xc, yc = 6, 1, 2
    points = generate_circle_points(1000, r, xc, yc)
    func = circle_func(r, xc, yc)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     100, 150)
    test_derivations(planes, func, verbose=False)
    #plane_creator.write_plane(planes, './chosen_datasets/moved_circle_6_1_2_100_150')
    DataSet.write_dataset(
        points, './chosen_points_datasets/moved_circle_6_1_2_100_150')
def save_moved_ellipse():
    ra, rb, xc, yc = 2.5, 5, 3, 4.5
    points = generate_ellipse_points(1000, ra, rb, xc, yc)
    func = ellipse_func(ra, rb, xc, yc)

    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points,
                                                     150, 200)
    test_derivations(planes, func, verbose=False)
    plane_creator.write_plane(
        planes, './chosen_datasets/moved_ellipse_2.5_5_3_4.5_100_150')
    DataSet.write_dataset(
        points, './chosen_points_datasets/moved_ellipse_2.5_5_3_4.5_100_150')
                    test_bench(plane_creator, src_filename, calc_func)


if __name__ == '__main__':
    dataset_name = "I.6.2a"
    calc_func = calc_1_6_20_a
    no_samples = 1000
    lows = [10, 20, 30, 40, 50, 60, 100, 200, 300]
    highs = [20, 30, 40, 50, 60, 70, 150, 250, 350]
    plane_creator = MultiDimEllipseCreator()

    cut = True
    process = True
    calc_error = True
    verbose = False

    original_filename = f"./datasets/Feynman_with_units/original/{dataset_name}"
    cut_filename = f"./datasets/Feynman_with_units/cut/{dataset_name}-{no_samples}"

    if cut:
        DataSet.cut_dataset(original_filename, cut_filename, no_samples)
    for low, high in zip(lows, highs):
        processed_filename = f"./poc/{dataset_name}-{no_samples}-{low}-{high}"
        if process:
            DataPreprocessor.preprocess_dataset(plane_creator, cut_filename,
                                                low, high, processed_filename)
        if calc_error:
            test_bench(plane_creator,
                       processed_filename,
                       calc_func,
                       verbose=verbose)
def save_harmonic_oscillator():
    points = generate_harmonic_oscillator_points(1000, 0, 10)
    planes = DataPreprocessor.get_planes_for_dataset(plane_creator, points, 50,
                                                     100)
    test_derivations(planes, harmonic_oscillator_calc, verbose=False)
    plane_creator.write_plane(planes, './chosen_datasets/harmosc_50_100')