To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 44d9eb9f authored by felikskiszkurno's avatar felikskiszkurno
Browse files

plot_and_save.py now uses contourf instead of scatter.

parent 95e7592b
......@@ -20,7 +20,7 @@ import pygimli.meshtools as mt
import pygimli.physics.ert as ert
# Config
create_new_data = True
create_new_data = False
# Prepare folder structure for output
is_success = slopestabilitytools.folder_structure.create_folder_structure()
......@@ -34,7 +34,7 @@ else:
# TODO Put this part into a function
# Settings
number_of_tests = 50
number_of_tests = 10
rho_spread_factor = 1.5
rho_max = 150
layers_min = 1
......@@ -59,4 +59,6 @@ else:
# Plot and save figures
slopestabilitytools.plot_and_save(test_name, test_results[test_name], 'Test: ' + test_name)
for test_name in test_results.keys():
slopestabilitytools.plot_and_save(test_name, test_results[test_name], 'Test: ' + test_name)
svm_accuracy_score, svm_accuracy_labels = slopestabilityML.svm_run(test_results)
......@@ -8,6 +8,7 @@ Created on 15.01.2021
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import slopestabilitytools
......@@ -19,19 +20,29 @@ def plot_and_save(test_name, test_result, plot_title):
inm = test_result['INM']
res = test_result['RES']
x_vec = np.unique(np.array(x))
y_vec = np.unique(np.array(y))
print(y_vec)
X, Y = np.meshgrid(x_vec, y_vec)
[m, n] = X.shape
inm_plot = np.array(inm).reshape((m, n))
res_plot = np.array(res).reshape((m, n))
print('plot_and_save')
print(X)
fig, ax = plt.subplots(3)
fig.suptitle(plot_title)
ax[0].scatter(x, y, inm)
ax[0].contourf(X, Y, inm_plot)
ax[0].set_title('Input model')
ax[0] = slopestabilitytools.set_labels(ax[0])
ax[1].scatter(x, y, res)
ax[1].contourf(X, Y, res_plot)
ax[1].set_title('Result')
ax[1] = slopestabilitytools.set_labels(ax[0])
ax[2].scatter(x, y, inm-res)
ax[2].contourf(X, Y, inm_plot-res_plot)
ax[2].set_title('Difference')
ax[2] = slopestabilitytools.set_labels(ax[0])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment