pygmi 2.2.7__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pygmi-2.2.7/LICENSE.txt +623 -0
- pygmi-2.2.7/MANIFEST.in +7 -0
- pygmi-2.2.7/PKG-INFO +47 -0
- pygmi-2.2.7/README.md +55 -0
- pygmi-2.2.7/README.rst +20 -0
- pygmi-2.2.7/log.txt +242 -0
- pygmi-2.2.7/pygmi/__init__.py +22 -0
- pygmi-2.2.7/pygmi/clust/__init__.py +4 -0
- pygmi-2.2.7/pygmi/clust/crisp_clust.py +708 -0
- pygmi-2.2.7/pygmi/clust/datatypes.py +65 -0
- pygmi-2.2.7/pygmi/clust/fuzzy_clust.py +906 -0
- pygmi-2.2.7/pygmi/clust/graphs.py +421 -0
- pygmi-2.2.7/pygmi/clust/graphtool.py +667 -0
- pygmi-2.2.7/pygmi/clust/menu.py +139 -0
- pygmi-2.2.7/pygmi/clust/var_ratio.py +92 -0
- pygmi-2.2.7/pygmi/clust/xie_beni.py +93 -0
- pygmi-2.2.7/pygmi/helpdocs/linepointer.png +0 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.main.html +31 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.ddisp.html +15 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.exportkmz.html +13 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.importpicture.html +16 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.layer.html +17 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.mext.html +44 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.misc.rangedcopy.html +16 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.param.html +37 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.prof.html +32 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.pview.html +26 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.gradients.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.tilt.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.visibility.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datagrid.html +13 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datamerge.html +11 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datareproj.html +11 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.rtp.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.ginterp.html +31 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.igrf.html +20 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.normalisation.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.smooth.html +22 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.tiltdepth.html +20 -0
- pygmi-2.2.7/pygmi/images/Help.png +0 -0
- pygmi-2.2.7/pygmi/images/bringtofront.png +0 -0
- pygmi-2.2.7/pygmi/images/cgs2.emf +0 -0
- pygmi-2.2.7/pygmi/images/delete.png +0 -0
- pygmi-2.2.7/pygmi/images/linepointer.png +0 -0
- pygmi-2.2.7/pygmi/images/logo256.ico +0 -0
- pygmi-2.2.7/pygmi/images/logo256.png +0 -0
- pygmi-2.2.7/pygmi/images/pointer.png +0 -0
- pygmi-2.2.7/pygmi/images/pygmi.png +0 -0
- pygmi-2.2.7/pygmi/images/sendtoback.png +0 -0
- pygmi-2.2.7/pygmi/main.py +1037 -0
- pygmi-2.2.7/pygmi/menu_default.py +327 -0
- pygmi-2.2.7/pygmi/misc.py +147 -0
- pygmi-2.2.7/pygmi/pfmod/__init__.py +6 -0
- pygmi-2.2.7/pygmi/pfmod/cubes.py +1488 -0
- pygmi-2.2.7/pygmi/pfmod/datatypes.py +292 -0
- pygmi-2.2.7/pygmi/pfmod/grvmag3d.py +1265 -0
- pygmi-2.2.7/pygmi/pfmod/iodefs.py +1001 -0
- pygmi-2.2.7/pygmi/pfmod/menu.py +107 -0
- pygmi-2.2.7/pygmi/pfmod/misc.py +301 -0
- pygmi-2.2.7/pygmi/pfmod/pfmod.py +248 -0
- pygmi-2.2.7/pygmi/pfmod/tab_ddisp.py +425 -0
- pygmi-2.2.7/pygmi/pfmod/tab_layer.py +490 -0
- pygmi-2.2.7/pygmi/pfmod/tab_mext.py +544 -0
- pygmi-2.2.7/pygmi/pfmod/tab_param.py +548 -0
- pygmi-2.2.7/pygmi/pfmod/tab_prof.py +946 -0
- pygmi-2.2.7/pygmi/pfmod/tab_pview.py +740 -0
- pygmi-2.2.7/pygmi/raster/IGRF11.COF +1635 -0
- pygmi-2.2.7/pygmi/raster/__init__.py +14 -0
- pygmi-2.2.7/pygmi/raster/cooper.py +718 -0
- pygmi-2.2.7/pygmi/raster/dataprep.py +1640 -0
- pygmi-2.2.7/pygmi/raster/datatypes.py +123 -0
- pygmi-2.2.7/pygmi/raster/equation_editor.py +256 -0
- pygmi-2.2.7/pygmi/raster/ginterp.py +1901 -0
- pygmi-2.2.7/pygmi/raster/graphs.py +531 -0
- pygmi-2.2.7/pygmi/raster/igrf.py +860 -0
- pygmi-2.2.7/pygmi/raster/iodefs.py +813 -0
- pygmi-2.2.7/pygmi/raster/menu.py +307 -0
- pygmi-2.2.7/pygmi/raster/normalisation.py +187 -0
- pygmi-2.2.7/pygmi/raster/show_table.py +245 -0
- pygmi-2.2.7/pygmi/raster/smooth.py +406 -0
- pygmi-2.2.7/pygmi/raster/tiltdepth.py +590 -0
- pygmi-2.2.7/pygmi/seis/__init__.py +0 -0
- pygmi-2.2.7/pygmi/seis/beachball.py +751 -0
- pygmi-2.2.7/pygmi/seis/datatypes.py +605 -0
- pygmi-2.2.7/pygmi/seis/del_rec.py +410 -0
- pygmi-2.2.7/pygmi/seis/iodefs.py +1261 -0
- pygmi-2.2.7/pygmi/seis/menu.py +136 -0
- pygmi-2.2.7/pygmi/seis/scan_imp.py +795 -0
- pygmi-2.2.7/pygmi/test/__init__.py +6 -0
- pygmi-2.2.7/pygmi/test/pfmod.py +212 -0
- pygmi-2.2.7/pygmi/test/tests.py +39 -0
- pygmi-2.2.7/pygmi/vector/__init__.py +7 -0
- pygmi-2.2.7/pygmi/vector/datatypes.py +74 -0
- pygmi-2.2.7/pygmi/vector/graphs.py +443 -0
- pygmi-2.2.7/pygmi/vector/iodefs.py +345 -0
- pygmi-2.2.7/pygmi/vector/menu.py +127 -0
- pygmi-2.2.7/pygmi.egg-info/PKG-INFO +47 -0
- pygmi-2.2.7/pygmi.egg-info/SOURCES.txt +105 -0
- pygmi-2.2.7/pygmi.egg-info/dependency_links.txt +1 -0
- pygmi-2.2.7/pygmi.egg-info/entry_points.txt +3 -0
- pygmi-2.2.7/pygmi.egg-info/not-zip-safe +1 -0
- pygmi-2.2.7/pygmi.egg-info/requires.txt +7 -0
- pygmi-2.2.7/pygmi.egg-info/top_level.txt +1 -0
- pygmi-2.2.7/quickstart.py +35 -0
- pygmi-2.2.7/setup.cfg +8 -0
- pygmi-2.2.7/setup.py +80 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: raster/graphs.py (part of PyGMI)
|
|
3
|
+
#
|
|
4
|
+
# Author: Patrick Cole
|
|
5
|
+
# E-Mail: pcole@geoscience.org.za
|
|
6
|
+
#
|
|
7
|
+
# Copyright: (c) 2013 Council for Geoscience
|
|
8
|
+
# Licence: GPL-3.0
|
|
9
|
+
#
|
|
10
|
+
# This file is part of PyGMI
|
|
11
|
+
#
|
|
12
|
+
# PyGMI is free software: you can redistribute it and/or modify
|
|
13
|
+
# it under the terms of the GNU General Public License as published by
|
|
14
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
15
|
+
# (at your option) any later version.
|
|
16
|
+
#
|
|
17
|
+
# PyGMI is distributed in the hope that it will be useful,
|
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
+
# GNU General Public License for more details.
|
|
21
|
+
#
|
|
22
|
+
# You should have received a copy of the GNU General Public License
|
|
23
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
24
|
+
# -----------------------------------------------------------------------------
|
|
25
|
+
"""
|
|
26
|
+
Plot Raster Data
|
|
27
|
+
|
|
28
|
+
This module provides a variety of methods to plot raster data via the context
|
|
29
|
+
menu. The following are supported:
|
|
30
|
+
|
|
31
|
+
* Correlation coefficients
|
|
32
|
+
* Images
|
|
33
|
+
* Surfaces
|
|
34
|
+
* Histograms
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
import numpy as np
|
|
38
|
+
from PyQt4 import QtGui, QtCore
|
|
39
|
+
import matplotlib.pyplot as plt
|
|
40
|
+
from matplotlib.backends.backend_qt4agg import FigureCanvas
|
|
41
|
+
from matplotlib.figure import Figure
|
|
42
|
+
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as \
|
|
43
|
+
NavigationToolbar
|
|
44
|
+
import matplotlib.colors as mcolors
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class MyMplCanvas(FigureCanvas):
|
|
48
|
+
"""
|
|
49
|
+
Canvas for the actual plot
|
|
50
|
+
|
|
51
|
+
Attributes
|
|
52
|
+
----------
|
|
53
|
+
axes : matplotlib subplot
|
|
54
|
+
parent : parent
|
|
55
|
+
reference to the parent routine
|
|
56
|
+
"""
|
|
57
|
+
def __init__(self, parent=None):
|
|
58
|
+
fig = Figure()
|
|
59
|
+
self.axes = fig.add_subplot(111)
|
|
60
|
+
self.parent = parent
|
|
61
|
+
|
|
62
|
+
FigureCanvas.__init__(self, fig)
|
|
63
|
+
|
|
64
|
+
def update_pcolor(self, data1, dmat):
|
|
65
|
+
"""
|
|
66
|
+
Update the correlation coefficient plot
|
|
67
|
+
|
|
68
|
+
Parameters
|
|
69
|
+
----------
|
|
70
|
+
data1 : PyGMI raster Data
|
|
71
|
+
raster dataset to be used in contouring
|
|
72
|
+
dmat : numpy array
|
|
73
|
+
dummy matrix of numbers to be plotted using pcolor
|
|
74
|
+
"""
|
|
75
|
+
self.figure.clear()
|
|
76
|
+
self.axes = self.figure.add_subplot(111)
|
|
77
|
+
self.axes.pcolor(dmat)
|
|
78
|
+
self.axes.axis('scaled')
|
|
79
|
+
self.axes.set_title('Correlation Coefficients')
|
|
80
|
+
for i in range(len(data1)):
|
|
81
|
+
for j in range(len(data1)):
|
|
82
|
+
self.axes.text(i + .1, j + .4, format(float(dmat[i, j]),
|
|
83
|
+
'4.2f'))
|
|
84
|
+
dat_mat = [i.dataid for i in data1]
|
|
85
|
+
self.axes.set_xticks(np.array(list(range(len(data1)))) + .5)
|
|
86
|
+
|
|
87
|
+
self.axes.set_xticklabels(dat_mat, rotation='vertical')
|
|
88
|
+
self.axes.set_yticks(np.array(list(range(len(data1)))) + .5)
|
|
89
|
+
|
|
90
|
+
self.axes.set_yticklabels(dat_mat, rotation='horizontal')
|
|
91
|
+
self.axes.set_xlim(0, len(data1))
|
|
92
|
+
self.axes.set_ylim(0, len(data1))
|
|
93
|
+
# self.figure.colorbar()
|
|
94
|
+
|
|
95
|
+
self.figure.tight_layout()
|
|
96
|
+
self.figure.canvas.draw()
|
|
97
|
+
|
|
98
|
+
def update_raster(self, data1, data2=None):
|
|
99
|
+
"""
|
|
100
|
+
Update the raster plot
|
|
101
|
+
|
|
102
|
+
Parameters
|
|
103
|
+
----------
|
|
104
|
+
data1 : PyGMI raster Data
|
|
105
|
+
raster dataset to be used in contouring
|
|
106
|
+
data2 : PyGMI point PData
|
|
107
|
+
points to be plotted over raster image
|
|
108
|
+
"""
|
|
109
|
+
self.figure.clear()
|
|
110
|
+
self.axes = self.figure.add_subplot(111)
|
|
111
|
+
|
|
112
|
+
extent = (data1.tlx, data1.tlx + data1.cols * data1.xdim,
|
|
113
|
+
data1.tly - data1.rows * data1.ydim, data1.tly)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
rdata = self.axes.imshow(data1.data, extent=extent,
|
|
117
|
+
interpolation='nearest')
|
|
118
|
+
|
|
119
|
+
cbar = self.figure.colorbar(rdata)
|
|
120
|
+
try:
|
|
121
|
+
cbar.set_label(data1.units)
|
|
122
|
+
except AttributeError:
|
|
123
|
+
pass
|
|
124
|
+
self.axes.set_xlabel("Eastings")
|
|
125
|
+
self.axes.set_ylabel("Northings")
|
|
126
|
+
|
|
127
|
+
tmp = self.axes.get_yticks()
|
|
128
|
+
self.axes.set_yticklabels(tmp, rotation='horizontal')
|
|
129
|
+
tmp = self.axes.get_xticks()
|
|
130
|
+
self.axes.set_xticklabels(tmp, rotation='vertical')
|
|
131
|
+
|
|
132
|
+
self.figure.tight_layout()
|
|
133
|
+
self.figure.canvas.draw()
|
|
134
|
+
|
|
135
|
+
def update_rgb(self, data1):
|
|
136
|
+
"""
|
|
137
|
+
Update the RGB plot
|
|
138
|
+
|
|
139
|
+
Parameters
|
|
140
|
+
----------
|
|
141
|
+
data1 : PyGMI raster Data
|
|
142
|
+
raster dataset to be used
|
|
143
|
+
"""
|
|
144
|
+
self.figure.clear()
|
|
145
|
+
self.axes = self.figure.add_subplot(111)
|
|
146
|
+
|
|
147
|
+
self.axes.imshow(data1.data)
|
|
148
|
+
|
|
149
|
+
self.figure.tight_layout()
|
|
150
|
+
self.figure.canvas.draw()
|
|
151
|
+
|
|
152
|
+
def update_hexbin(self, data1, data2):
|
|
153
|
+
"""
|
|
154
|
+
Update the hexbin plot
|
|
155
|
+
|
|
156
|
+
Parameters
|
|
157
|
+
----------
|
|
158
|
+
data1 : PyGMI raster Data
|
|
159
|
+
raster dataset to be used
|
|
160
|
+
data2 : PyGMI raster Data
|
|
161
|
+
raster dataset to be used
|
|
162
|
+
"""
|
|
163
|
+
self.figure.clear()
|
|
164
|
+
self.axes = self.figure.add_subplot(111)
|
|
165
|
+
x = data1.copy()
|
|
166
|
+
y = data2.copy()
|
|
167
|
+
msk = np.logical_or(x.mask, y.mask)
|
|
168
|
+
x.mask = msk
|
|
169
|
+
y.mask = msk
|
|
170
|
+
x = x.compressed()
|
|
171
|
+
y = y.compressed()
|
|
172
|
+
|
|
173
|
+
xmin = x.min()
|
|
174
|
+
xmax = x.max()
|
|
175
|
+
ymin = y.min()
|
|
176
|
+
ymax = y.max()
|
|
177
|
+
|
|
178
|
+
hbin = self.axes.hexbin(x, y, bins='log')
|
|
179
|
+
self.axes.axis([xmin, xmax, ymin, ymax])
|
|
180
|
+
self.axes.set_title('Hexbin Plot')
|
|
181
|
+
cbar = self.figure.colorbar(hbin)
|
|
182
|
+
cbar.set_label('log10(N)')
|
|
183
|
+
|
|
184
|
+
self.figure.tight_layout()
|
|
185
|
+
self.figure.canvas.draw()
|
|
186
|
+
|
|
187
|
+
def update_wireframe(self, data):
|
|
188
|
+
"""
|
|
189
|
+
Update the surface wireframe plot
|
|
190
|
+
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
data : PyGMI raster Data
|
|
194
|
+
raster dataset to be used
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
x = data.tlx+np.arange(data.cols)*data.xdim+data.xdim/2
|
|
198
|
+
y = data.tly-np.arange(data.rows)*data.ydim-data.ydim/2
|
|
199
|
+
x, y = np.meshgrid(x, y)
|
|
200
|
+
z = data.data.copy()
|
|
201
|
+
if not np.ma.is_masked(z):
|
|
202
|
+
z = np.ma.array(z)
|
|
203
|
+
|
|
204
|
+
x = np.ma.array(x, mask=z.mask)
|
|
205
|
+
y = np.ma.array(y, mask=z.mask)
|
|
206
|
+
|
|
207
|
+
z[z.mask] = np.nan
|
|
208
|
+
z.mask = data.data.mask.copy()
|
|
209
|
+
cmap = plt.cm.jet
|
|
210
|
+
cmap.set_bad('w', 0.)
|
|
211
|
+
cmap.set_under('w', 0.)
|
|
212
|
+
|
|
213
|
+
lev = np.arange(z.min(), z.max(), 1)
|
|
214
|
+
norml = mcolors.BoundaryNorm(lev, 256)
|
|
215
|
+
|
|
216
|
+
self.figure.clear()
|
|
217
|
+
self.axes = self.figure.add_subplot(111, projection='3d')
|
|
218
|
+
ax = self.axes
|
|
219
|
+
ax.plot_surface(x, y, z, cmap=cmap, linewidth=0.1, norm=norml,
|
|
220
|
+
shade=True)
|
|
221
|
+
|
|
222
|
+
ax.set_title('')
|
|
223
|
+
ax.set_xlabel("X")
|
|
224
|
+
ax.set_ylabel("Y")
|
|
225
|
+
ax.set_zlabel("Z")
|
|
226
|
+
|
|
227
|
+
self.figure.canvas.draw()
|
|
228
|
+
|
|
229
|
+
def update_hist(self, data1):
|
|
230
|
+
"""
|
|
231
|
+
Update the hiostogram plot
|
|
232
|
+
|
|
233
|
+
Parameters
|
|
234
|
+
----------
|
|
235
|
+
data1 : PyGMI raster Data
|
|
236
|
+
raster dataset to be used
|
|
237
|
+
"""
|
|
238
|
+
self.figure.clear()
|
|
239
|
+
self.axes = self.figure.add_subplot(111)
|
|
240
|
+
|
|
241
|
+
dattmp = data1.data[data1.data.mask == 0].flatten()
|
|
242
|
+
self.axes.hist(dattmp, 50)
|
|
243
|
+
self.axes.set_title(data1.dataid, fontsize=12)
|
|
244
|
+
self.axes.set_xlabel("Data Value", fontsize=8)
|
|
245
|
+
self.axes.set_ylabel("Counts", fontsize=8)
|
|
246
|
+
|
|
247
|
+
self.figure.tight_layout()
|
|
248
|
+
self.figure.canvas.draw()
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class GraphWindow(QtGui.QDialog):
|
|
252
|
+
"""
|
|
253
|
+
Graph Window - The QDialog window which will contain our image
|
|
254
|
+
|
|
255
|
+
Attributes
|
|
256
|
+
----------
|
|
257
|
+
parent : parent
|
|
258
|
+
reference to the parent routine
|
|
259
|
+
"""
|
|
260
|
+
def __init__(self, parent=None):
|
|
261
|
+
QtGui.QDialog.__init__(self, parent=None)
|
|
262
|
+
self.parent = parent
|
|
263
|
+
|
|
264
|
+
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
|
265
|
+
self.setWindowTitle("Graph Window")
|
|
266
|
+
|
|
267
|
+
vbl = QtGui.QVBoxLayout(self) # self is where layout is assigned
|
|
268
|
+
self.hbl = QtGui.QHBoxLayout()
|
|
269
|
+
self.mmc = MyMplCanvas(self)
|
|
270
|
+
mpl_toolbar = NavigationToolbar(self.mmc, self.parent)
|
|
271
|
+
|
|
272
|
+
self.combobox1 = QtGui.QComboBox()
|
|
273
|
+
self.combobox2 = QtGui.QComboBox()
|
|
274
|
+
self.label1 = QtGui.QLabel()
|
|
275
|
+
self.label2 = QtGui.QLabel()
|
|
276
|
+
self.label1.setText('Bands:')
|
|
277
|
+
self.label2.setText('Bands:')
|
|
278
|
+
self.hbl.addWidget(self.label1)
|
|
279
|
+
self.hbl.addWidget(self.combobox1)
|
|
280
|
+
self.hbl.addWidget(self.label2)
|
|
281
|
+
self.hbl.addWidget(self.combobox2)
|
|
282
|
+
|
|
283
|
+
vbl.addWidget(self.mmc)
|
|
284
|
+
vbl.addWidget(mpl_toolbar)
|
|
285
|
+
vbl.addLayout(self.hbl)
|
|
286
|
+
|
|
287
|
+
self.setFocus()
|
|
288
|
+
|
|
289
|
+
self.combobox1.currentIndexChanged.connect(self.change_band)
|
|
290
|
+
self.combobox2.currentIndexChanged.connect(self.change_band)
|
|
291
|
+
|
|
292
|
+
def change_band(self):
|
|
293
|
+
""" Combo box to choose band """
|
|
294
|
+
pass
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class PlotCCoef(GraphWindow):
|
|
298
|
+
"""
|
|
299
|
+
Plot 2D Correlation Coeffiecients
|
|
300
|
+
|
|
301
|
+
Attributes
|
|
302
|
+
----------
|
|
303
|
+
label1 : QLabel
|
|
304
|
+
reference to GraphWindow's label1
|
|
305
|
+
combobox1 : QComboBox
|
|
306
|
+
reference to GraphWindow's combobox1
|
|
307
|
+
label2 : QLabel
|
|
308
|
+
reference to GraphWindow's label2
|
|
309
|
+
combobox2 : QComboBox
|
|
310
|
+
reference to GraphWindow's combobox2
|
|
311
|
+
parent : parent
|
|
312
|
+
reference to the parent routine
|
|
313
|
+
indata : dictionary
|
|
314
|
+
dictionary of input datasets
|
|
315
|
+
"""
|
|
316
|
+
def __init__(self, parent):
|
|
317
|
+
GraphWindow.__init__(self, parent)
|
|
318
|
+
self.label1.hide()
|
|
319
|
+
self.combobox1.hide()
|
|
320
|
+
self.label2.hide()
|
|
321
|
+
self.combobox2.hide()
|
|
322
|
+
self.indata = {}
|
|
323
|
+
self.parent = parent
|
|
324
|
+
|
|
325
|
+
def change_band(self):
|
|
326
|
+
""" Combo box to choose band """
|
|
327
|
+
pass
|
|
328
|
+
|
|
329
|
+
def run(self):
|
|
330
|
+
""" Run """
|
|
331
|
+
self.show()
|
|
332
|
+
data = self.indata['Raster']
|
|
333
|
+
|
|
334
|
+
dummy_mat = [[self.corr2d(i.data, j.data) for j in data] for i in data]
|
|
335
|
+
dummy_mat = np.array(dummy_mat)
|
|
336
|
+
|
|
337
|
+
self.mmc.update_pcolor(data, dummy_mat)
|
|
338
|
+
|
|
339
|
+
def corr2d(self, dat1, dat2):
|
|
340
|
+
"""
|
|
341
|
+
Calculate the 2D correlation
|
|
342
|
+
|
|
343
|
+
Parameters
|
|
344
|
+
----------
|
|
345
|
+
dat1 : numpy array
|
|
346
|
+
dataset 1 for use in correlation calculation
|
|
347
|
+
dat2 : numpy array
|
|
348
|
+
dataset 2 for use in correlation calculation
|
|
349
|
+
|
|
350
|
+
Returns
|
|
351
|
+
-------
|
|
352
|
+
out : numpy array
|
|
353
|
+
array of correlation coefficients
|
|
354
|
+
"""
|
|
355
|
+
|
|
356
|
+
out = None
|
|
357
|
+
if dat1.shape == dat2.shape:
|
|
358
|
+
mdat1 = dat1 - dat1.mean()
|
|
359
|
+
mdat2 = dat2 - dat2.mean()
|
|
360
|
+
numerator = (mdat1 * mdat2).sum()
|
|
361
|
+
denominator = np.sqrt((mdat1 ** 2).sum() * (mdat2 ** 2).sum())
|
|
362
|
+
out = numerator / denominator
|
|
363
|
+
|
|
364
|
+
return out
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class PlotRaster(GraphWindow):
|
|
368
|
+
"""
|
|
369
|
+
Plot Raster Class
|
|
370
|
+
|
|
371
|
+
Attributes
|
|
372
|
+
----------
|
|
373
|
+
label2 : QLabel
|
|
374
|
+
reference to GraphWindow's label2
|
|
375
|
+
combobox2 : QComboBox
|
|
376
|
+
reference to GraphWindow's combobox2
|
|
377
|
+
parent : parent
|
|
378
|
+
reference to the parent routine
|
|
379
|
+
indata : dictionary
|
|
380
|
+
dictionary of input datasets
|
|
381
|
+
"""
|
|
382
|
+
def __init__(self, parent):
|
|
383
|
+
GraphWindow.__init__(self, parent)
|
|
384
|
+
self.label2.hide()
|
|
385
|
+
self.combobox2.hide()
|
|
386
|
+
self.indata = {}
|
|
387
|
+
self.parent = parent
|
|
388
|
+
|
|
389
|
+
def change_band(self):
|
|
390
|
+
""" Combo box to choose band """
|
|
391
|
+
i = self.combobox1.currentIndex()
|
|
392
|
+
data2 = None
|
|
393
|
+
if 'Point' in self.indata:
|
|
394
|
+
data2 = self.indata['Point'][0]
|
|
395
|
+
if 'Raster' in self.indata:
|
|
396
|
+
data = self.indata['Raster']
|
|
397
|
+
self.mmc.update_raster(data[i], data2)
|
|
398
|
+
elif 'ProfPic' in self.indata:
|
|
399
|
+
data = self.indata['ProfPic']
|
|
400
|
+
self.mmc.update_rgb(data[i])
|
|
401
|
+
|
|
402
|
+
def run(self):
|
|
403
|
+
""" Run """
|
|
404
|
+
self.show()
|
|
405
|
+
if 'Raster' in self.indata:
|
|
406
|
+
data = self.indata['Raster']
|
|
407
|
+
elif 'Cluster' in self.indata:
|
|
408
|
+
data = self.indata['Cluster']
|
|
409
|
+
elif 'ProfPic' in self.indata:
|
|
410
|
+
data = self.indata['ProfPic']
|
|
411
|
+
|
|
412
|
+
for i in data:
|
|
413
|
+
self.combobox1.addItem(i.dataid)
|
|
414
|
+
self.change_band()
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
class PlotSurface(GraphWindow):
|
|
418
|
+
"""
|
|
419
|
+
Plot Raster Class
|
|
420
|
+
|
|
421
|
+
Attributes
|
|
422
|
+
----------
|
|
423
|
+
label2 : QLabel
|
|
424
|
+
reference to GraphWindow's label2
|
|
425
|
+
combobox2 : QComboBox
|
|
426
|
+
reference to GraphWindow's combobox2
|
|
427
|
+
parent : parent
|
|
428
|
+
reference to the parent routine
|
|
429
|
+
indata : dictionary
|
|
430
|
+
dictionary of input datasets
|
|
431
|
+
"""
|
|
432
|
+
def __init__(self, parent):
|
|
433
|
+
GraphWindow.__init__(self, parent)
|
|
434
|
+
self.label2.hide()
|
|
435
|
+
self.combobox2.hide()
|
|
436
|
+
self.indata = {}
|
|
437
|
+
self.parent = parent
|
|
438
|
+
|
|
439
|
+
def change_band(self):
|
|
440
|
+
""" Combo box to choose band """
|
|
441
|
+
i = self.combobox1.currentIndex()
|
|
442
|
+
if 'Raster' in self.indata:
|
|
443
|
+
data = self.indata['Raster']
|
|
444
|
+
self.mmc.update_wireframe(data[i])
|
|
445
|
+
|
|
446
|
+
def run(self):
|
|
447
|
+
""" Run """
|
|
448
|
+
if 'Raster' in self.indata:
|
|
449
|
+
self.show()
|
|
450
|
+
data = self.indata['Raster']
|
|
451
|
+
|
|
452
|
+
for i in data:
|
|
453
|
+
self.combobox1.addItem(i.dataid)
|
|
454
|
+
self.change_band()
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
class PlotScatter(GraphWindow):
|
|
458
|
+
"""
|
|
459
|
+
Plot Hexbin Class. A Hexbin is a type of scatter plot which is raster.
|
|
460
|
+
|
|
461
|
+
Attributes
|
|
462
|
+
----------
|
|
463
|
+
parent : parent
|
|
464
|
+
reference to the parent routine
|
|
465
|
+
indata : dictionary
|
|
466
|
+
dictionary of input datasets
|
|
467
|
+
"""
|
|
468
|
+
def __init__(self, parent):
|
|
469
|
+
GraphWindow.__init__(self, parent=None)
|
|
470
|
+
self.indata = {}
|
|
471
|
+
self.parent = parent
|
|
472
|
+
|
|
473
|
+
def change_band(self):
|
|
474
|
+
""" Combo box to choose band """
|
|
475
|
+
data = self.indata['Raster']
|
|
476
|
+
i = self.combobox1.currentIndex()
|
|
477
|
+
j = self.combobox2.currentIndex()
|
|
478
|
+
self.mmc.update_hexbin(data[i].data, data[j].data)
|
|
479
|
+
|
|
480
|
+
def run(self):
|
|
481
|
+
""" Run """
|
|
482
|
+
self.show()
|
|
483
|
+
data = self.indata['Raster']
|
|
484
|
+
for i in data:
|
|
485
|
+
self.combobox1.addItem(i.dataid)
|
|
486
|
+
self.combobox2.addItem(i.dataid)
|
|
487
|
+
|
|
488
|
+
self.label1.setText('X Band:')
|
|
489
|
+
self.label2.setText('Y Band:')
|
|
490
|
+
self.combobox1.setCurrentIndex(0)
|
|
491
|
+
self.combobox2.setCurrentIndex(1)
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
class PlotHist(GraphWindow):
|
|
495
|
+
"""
|
|
496
|
+
Plot Hist Class
|
|
497
|
+
|
|
498
|
+
Attributes
|
|
499
|
+
----------
|
|
500
|
+
label2 : QLabel
|
|
501
|
+
reference to GraphWindow's label2
|
|
502
|
+
combobox2 : QComboBox
|
|
503
|
+
reference to GraphWindow's combobox2
|
|
504
|
+
parent : parent
|
|
505
|
+
reference to the parent routine
|
|
506
|
+
indata : dictionary
|
|
507
|
+
dictionary of input datasets
|
|
508
|
+
"""
|
|
509
|
+
def __init__(self, parent):
|
|
510
|
+
GraphWindow.__init__(self, parent)
|
|
511
|
+
self.label2.hide()
|
|
512
|
+
self.combobox2.hide()
|
|
513
|
+
self.indata = {}
|
|
514
|
+
self.parent = parent
|
|
515
|
+
|
|
516
|
+
def change_band(self):
|
|
517
|
+
""" Combo box to choose band """
|
|
518
|
+
data = self.indata['Raster']
|
|
519
|
+
i = self.combobox1.currentIndex()
|
|
520
|
+
self.mmc.update_hist(data[i])
|
|
521
|
+
|
|
522
|
+
def run(self):
|
|
523
|
+
""" Run """
|
|
524
|
+
self.show()
|
|
525
|
+
data = self.indata['Raster']
|
|
526
|
+
for i in data:
|
|
527
|
+
self.combobox1.addItem(i.dataid)
|
|
528
|
+
|
|
529
|
+
self.label1.setText('Band:')
|
|
530
|
+
self.combobox1.setCurrentIndex(0)
|
|
531
|
+
self.change_band()
|