forked from asaintenoy/Porchet-GPR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
outils.py
executable file
·32 lines (28 loc) · 993 Bytes
/
outils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 14:24:20 2020
@author: el
"""
import matplotlib.pyplot as plt
import numpy as np
import pygimli as pg
from pygimli.meshtools import polytools as plc
from pygimli.meshtools import quality
def showQuality(mesh, qualities):
fig, axes = plt.subplots(1, 2)
axes[1].hist(qualities, color="grey")
pg.show(mesh, qualities, ax=axes[0], cMin=0.5, cMax=1, hold=True,
logScale=False, label="Mesh quality", cmap="RdYlGn", showMesh=True)
s = "Min: %.2f, Mean: %.2f, Max: %.2f" % (
np.min(qualities), np.mean(qualities), np.max(qualities))
axes[1].set_title(s)
axes[1].set_xlabel("Mesh quality")
axes[1].set_ylabel("Frequency")
axes[1].set_xlim(0, 1)
# Figure resizing according to mesh dimesions
x = mesh.xmax() - mesh.xmin()
y = mesh.ymax() - mesh.ymin()
width, height = fig.get_size_inches()
fig.set_figheight(height * 1.3 * (y / x))
fig.tight_layout()