Commit 4189de08 authored by Feliks Kuba Kiszkurno's avatar Feliks Kuba Kiszkurno
Browse files

Simplified file structure

Merged both functions related to observation points into one file.
parent 7418f269
import matplotlib.pyplot as plt
import os
def plot_points(points_dict, experiments_folder, exp_size=None):
x = []
y = []
labels = []
for point in points_dict:
x.append(points_dict[point][0])
y.append(points_dict[point][1])
labels.append(point)
fig, ax = plt.subplots()
ax.scatter(x, y)
for i, point_label in enumerate(labels):
ax.annotate(point_label, (x[i], y[i]))
if exp_size is not None:
ax.set_xlim([exp_size[0], exp_size[1]])
ax.set_ylim([exp_size[2], exp_size[3]])
ax.set_title('Positions of points')
ax.set_xlabel('X [m]')
ax.set_ylabel('Y [m]')
#fig.show()
for ext in ['png']:
fig.savefig(os.path.join(experiments_folder, 'Results', 'points_overview.'+ext))
\ No newline at end of file
......@@ -7,7 +7,8 @@ Created on Thu Mar 10 09:20:36 2022
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
def load_points(file_path):
......@@ -40,3 +41,26 @@ def load_points(file_path):
points_y[point_id],
points_z[point_id])
return points
def plot_points(points_dict, experiments_folder, exp_size=None):
x = []
y = []
labels = []
for point in points_dict:
x.append(points_dict[point][0])
y.append(points_dict[point][1])
labels.append(point)
fig, ax = plt.subplots()
ax.scatter(x, y)
for i, point_label in enumerate(labels):
ax.annotate(point_label, (x[i], y[i]))
if exp_size is not None:
ax.set_xlim([exp_size[0], exp_size[1]])
ax.set_ylim([exp_size[2], exp_size[3]])
ax.set_title('Positions of points')
ax.set_xlabel('X [m]')
ax.set_ylabel('Y [m]')
# fig.show()
for ext in ['png']:
fig.savefig(os.path.join(experiments_folder, 'Results', 'points_overview.' + ext))
from ogs_compare.Tools.load_points import load_points
from ogs_compare.Tools.plot_points import plot_points
from ogs_compare.Tools.points import load_points, plot_points
from ogs_compare.Tools.detect_experiments import detect_experiments, getfilesbyextension
from ogs_compare.ogs_compare import OGSDataCompare
......@@ -5,8 +5,7 @@ import matplotlib.pyplot as plt
import itertools
import numpy as np
from ogs_compare.Tools.load_points import load_points
from ogs_compare.Tools.plot_points import plot_points
from ogs_compare.Tools.points import load_points, plot_points
from ogs_compare.Tools.read_data import read_data
from ogs_compare.Tools.detect_experiments import detect_experiments, extract_params
from ogs_compare.Tools.legend_without_duplicate_labels import legend_without_duplicate_labels
......@@ -96,8 +95,7 @@ class OGSDataCompare:
label_temp = 'analytical_model'
else:
if sub_params_n > 1:
exp_data_plot = self.data.experiments_results_param[reference_experiment][point_name][:,
sub_param]
exp_data_plot = self.data.experiments_results_param[reference_experiment][point_name][:, sub_param]
else:
exp_data_plot = self.data.experiments_results_param[reference_experiment][point_name]
experiments_to_include_new = self.data.experiments.copy()
......
Supports Markdown
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