errors = calc_square_error_for_list(test_output, prediction) errors_full = calc_square_error_for_list( fill_strategy.solutions[:, 16:48, 16:48, :], prediction_full) #print(errors) saveModel(model, fileName) trainingsSetConfig = TrainingsSetConfig(gridSize, gridSize, "1", epochs, count, fill_strategy.charges, datetime.datetime.utcnow()) write_data_configuration(fileName, trainingsSetConfig) results = Results(inputset_duration, solutionset_duration, learning_duration, errors) write_results(fileName + '_results', results) #results_full = Results(inputset_duration, solutionset_duration, learning_duration, errors_full) #write_results(fileName + '_results_full', results_full) showGraph = 0 if platform.uname()[1] != 'qcd': showGraph = 1 if showGraph: from sources.experiments.fdm_helper import plotSurface import matplotlib.pyplot as plt for i in range(0, 5): plotSurface(pde.geometry.X[16:48, 16:48], pde.geometry.Y[16:48, 16:48], prediction[i, :, :, 0]) plt.show()
pde.setAuxiliaryFunctions({'eps': eps}) pde.configureGrid() return pde if __name__ == '__main__': pdeNr = 4 pde = None if pdeNr == 1: pde = setupPDE_finite_differences() elif pdeNr == 2: pde = setupPDE_finite_differences_with_eps() elif pdeNr == 3: pde = setupPDE_vector_calculus() elif pdeNr == 4: pde = setupPDE_vector_calculus_with_eps() else: raise Exception("Invalid pdeNr:" + pdeNr) charges = make_central_charge(pde.geometry) resulting_matrix = pde.solve(charges) showGraph = 1 if showGraph: plotSurface(pde.geometry.X, pde.geometry.Y, resulting_matrix) plt.show()
errors = calc_square_error_for_list(test_output, prediction) errors_full = calc_square_error_for_list(fill_strategy.solutions, prediction_full) #print(errors) saveModel(model, fileName) trainingsSetConfig = TrainingsSetConfig(gridSize, gridSize, "1", epochs, count, fill_strategy.charges, datetime.datetime.utcnow()) write_data_configuration(fileName, trainingsSetConfig) results = Results(inputset_duration, solutionset_duration, learning_duration, errors) write_results(fileName + '_results', results) results_full = Results(inputset_duration, solutionset_duration, learning_duration, errors_full) write_results(fileName + '_results_full', results_full) showGraph = 0 if platform.uname()[1] != 'qcd': showGraph = 1 if showGraph: from sources.experiments.fdm_helper import plotSurface import matplotlib.pyplot as plt plotSurface(pde.geometry.X, pde.geometry.Y, prediction[0, :, :, 0]) plt.show()
from sources.experiments.charges_generators import make_comb from sources.experiments.fdm_helper import plotSurface, solve_finite_differences from sources.pdesolver.finite_differences_method.boundaryconditions import RectangularBoundaryCondition from sources.pdesolver.finite_differences_method.geometry import Geometry from sources.pdesolver.finite_differences_method.rectangle import Rectangle if __name__ == '__main__': delta = 1.0 rect = Rectangle(0, 0, 32.0, 32.0) g = Geometry(rect, delta) print(g.numX, g.numY) boundaryCondition = RectangularBoundaryCondition(g) charges = make_comb(g, delta) start = time.clock() duration = time.clock() - start fdm = solve_finite_differences(g, boundaryCondition, charges) print(duration) showGraph = 1 if showGraph: plotSurface(fdm.geometry.X, fdm.geometry.Y, fdm.values) plt.show()