-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathplotting.py
108 lines (104 loc) · 4.26 KB
/
plotting.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 24 13:36:21 2022
@author: AJITHABH K. S.
Last modified: 21-07-2022
This module plots four figures after the processing is completed.
1. Apparent resistivity and phase.
2. Coherency values for Ex and Ey components.
3. Tipper amplitudes and phase
4. Tipper real and imaginary components.
"""
def plotfigs(procinfo, ftlist, Z_huber, Zvar, Tx, Ty, cohEx, cohEy):
import numpy as np
from matplotlib import pyplot as plt
# ----------------------------------------------------------------------
# Apparant resistivities and phase
rho_xy = (0.2/ftlist) * ((abs(Z_huber.get('Zxy'))) ** 2)
rho_yx = (0.2/ftlist) * ((abs(Z_huber.get('Zyx'))) ** 2)
phase_xy = np.degrees(np.arctan(Z_huber.get('Zxy').imag/Z_huber.get('Zxy').real))
phase_yx = np.degrees(np.arctan(Z_huber.get('Zyx').imag/Z_huber.get('Zyx').real))
#
#
# Errors for app. resistivity and phase
err_rxy = (0.4/ftlist) * ((abs(Z_huber.get('Zxy')))) * Zvar.get('xy')
err_ryx = (0.4/ftlist) * ((abs(Z_huber.get('Zyx')))) * Zvar.get('yx')
err_pxy = np.degrees((Zvar.get('xy')) / abs(Z_huber.get('Zxy')))
err_pyx = np.degrees((Zvar.get('yx')) / abs(Z_huber.get('Zyx')))
err_rxy = err_rxy.reshape((-1,))
err_ryx = err_ryx.reshape((-1,))
err_pxy = err_pxy.reshape((-1,))
err_pyx = err_pyx.reshape((-1,))
#
# Plotting section
#
plt.figure(num=1)
plt.subplot(211)
plt.scatter(ftlist,rho_xy,c='r',s=10)
plt.scatter(ftlist,rho_yx,c='b',s=10)
plt.errorbar(ftlist,rho_xy,err_rxy,ecolor='r',fmt="none")
plt.errorbar(ftlist,rho_yx,err_ryx,ecolor='b',fmt="none")
plt.xscale('log')
plt.yscale('log')
plt.xlim((10000, 0.001))
plt.ylim(0.1, 100000)
plt.yticks([0.1, 1, 10, 100, 1000, 10000])
plt.grid(which='both',linestyle='-.', linewidth=0.4)
plt.title(procinfo.get('selectedsite') + ' - ' + procinfo.get('meas')+' ('+str(procinfo.get('fs'))+' Hz)')
plt.subplot(212)
plt.scatter(ftlist,phase_xy,c='r',s=10)
plt.scatter(ftlist,phase_yx,c='b',s=10)
plt.errorbar(ftlist,phase_xy,err_pxy,ecolor='r',fmt="none")
plt.errorbar(ftlist,phase_yx,err_pyx,ecolor='b',fmt="none")
plt.xscale('log')
plt.xlim((10000, 0.001))
plt.ylim((0, 90))
plt.yticks([0,15,30,45,60,75,90])
plt.grid(which='both',linestyle='-.', linewidth=0.4)
# plt.savefig('C:/Users/ajithabh/Desktop/MTProc/'+ procinfo.get('meas')+'.png', format='png', dpi=600)
plt.figure(num=2)
plt.scatter(ftlist,cohEx,c='r')
plt.scatter(ftlist,cohEy,c='b')
plt.xscale('log')
plt.xlim((10000, 0.001))
plt.ylim(0, 1)
plt.yticks([0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0])
plt.grid(which='both',linestyle='-.', linewidth=0.4)
plt.title(procinfo.get('selectedsite') + ' - ' + procinfo.get('meas')+' ('+str(procinfo.get('fs'))+' Hz)')
# plt.savefig('C:/Users/ajithabh/Desktop/MTProc/'+ 'coh' + procinfo.get('meas')+'.png', format='png', dpi=600)
# Plot tipper =====
TxA = np.sqrt((np.real(Tx) ** 2) + (np.imag(Tx) ** 2))
TyA = np.sqrt((np.real(Ty) ** 2) + (np.imag(Ty) ** 2))
TxP = np.degrees(np.arctan2(Tx.imag,Tx.real))
TyP = np.degrees(np.arctan2(Ty.imag,Ty.real))
plt.figure(num=3)
plt.subplot(211)
plt.scatter(ftlist,TxA,c='r')
plt.scatter(ftlist,TyA,c='b')
plt.ylim(0, 1)
plt.xscale('log')
plt.xlim((10000, 0.001))
plt.grid(which='both',linestyle='-.', linewidth=0.4)
plt.title(procinfo.get('selectedsite') + ' - ' + procinfo.get('meas')+' ('+str(procinfo.get('fs'))+' Hz)')
plt.subplot(212)
plt.scatter(ftlist,TxP,c='r')
plt.scatter(ftlist,TyP,c='b')
plt.xscale('log')
plt.xlim((10000, 0.001))
plt.grid(which='both',linestyle='-.', linewidth=0.4)
#----------
plt.figure(num=4)
plt.subplot(211)
plt.scatter(ftlist,Tx.real,c='r')
plt.scatter(ftlist,Ty.real,c='b')
#plt.ylim(0, 1)
plt.xscale('log')
plt.xlim((10000, 0.001))
plt.grid(which='both',linestyle='-.', linewidth=0.4)
plt.title(procinfo.get('selectedsite') + ' - ' + procinfo.get('meas')+' ('+str(procinfo.get('fs'))+' Hz)')
plt.subplot(212)
plt.scatter(ftlist,Tx.imag,c='r')
plt.scatter(ftlist,Ty.imag,c='b')
plt.xscale('log')
plt.xlim((10000, 0.001))
plt.grid(which='both',linestyle='-.', linewidth=0.4)