-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathplot-coherency.py
81 lines (73 loc) · 2.63 KB
/
plot-coherency.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
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 20 15:52:42 2020
@author: AJITHABH K. S.
Last modified: 21-07-2022
This script can be used to plot coherency values
for all the time windows for all target frequencies.
This script enables ploting of the coherency values
for Ex and Ey components in an argand diagram. Any impedance
value can be selected for plotting. The color of the data points
indicate the coherency value.
To plot Ex component, make
cc = AllcohEx[fnum,:]
Similarly for Ey, make
cc = AllcohEy[fnum,:]
Change 'Zxy_single' to 'Zyx_single' in following line
to choose argand diagram of Zyx component.
Z_all = bandavg.get('Zxy_single')
"""
import matplotlib
#matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
cdict = {'red': ((0.0, 0.0, 0.0),
(0.1, 0.5, 0.5),
(0.2, 0.0, 0.0),
(0.4, 0.2, 0.2),
(0.6, 0.0, 0.0),
(0.8, 1.0, 1.0),
(1.0, 1.0, 1.0)),
'green':((0.0, 0.0, 0.0),
(0.1, 0.0, 0.0),
(0.2, 0.0, 0.0),
(0.4, 1.0, 1.0),
(0.6, 1.0, 1.0),
(0.8, 1.0, 1.0),
(1.0, 0.0, 0.0)),
'blue': ((0.0, 0.0, 0.0),
(0.1, 0.5, 0.5),
(0.2, 1.0, 1.0),
(0.4, 1.0, 1.0),
(0.6, 0.0, 0.0),
(0.8, 0.0, 0.0),
(1.0, 0.0, 0.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap('my_colormap',cdict,256)
"""
Try 'Zxy_single', 'Zyx_single', 'Zxx_single', 'Zyy_single'
in the below field as required
"""
Z_all = bandavg.get('Zxy_single')
coh_selected_all = np.ones(np.shape(bandavg.get('ExExc')),dtype=float)
for fnum in range(np.size(ftlist)):
Z = Z_all[fnum,:]
coh_selected = coh_selected_all[fnum,:].reshape(-1,1)
"""
Try: cc = AllcohEx[fnum,:] to plot Ex component
Try: cc = AllcohEy[fnum,:] to plot Ey component
"""
cc = AllcohEx[fnum,:]
cc = cc.reshape(-1,1)
Z = Z.reshape(-1,1)
ind_coh = np.where(coh_selected==0)[0].reshape(-1,1)
cc = np.delete(cc,ind_coh).reshape(-1,1)
Z = np.delete(Z,ind_coh).reshape(-1,1)
Z_real = np.real(Z)
Z_imag = np.imag(Z)
plt.figure(num=fnum)
sc = plt.scatter(Z_real,Z_imag,c=cc,cmap=my_cmap)
plt.colorbar(sc)
plt.clim(0,1)
# plt.scatter(Z_huber[fnum].real,Z_huber[fnum].imag,c='black',marker=(5, 1))
plt.title(procinfo.get('selectedsite') + ' - ' + procinfo.get('meas')+
' ('+str(procinfo.get('fs'))+' Hz) f='+ str(round(ftlist[fnum][0],2)) +' Hz')
# plt.savefig('C:/Users/Ajithabh/Desktop/myImagePDF.eps', format='eps', dpi=1200)