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,421 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: clust/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
|
+
""" Plot Cluster Data """
|
|
26
|
+
|
|
27
|
+
import numpy as np
|
|
28
|
+
from PyQt4 import QtGui, QtCore
|
|
29
|
+
import matplotlib.pyplot as plt
|
|
30
|
+
from mpl_toolkits.mplot3d import axes3d # this is used, ignore warning
|
|
31
|
+
from matplotlib.backends.backend_qt4agg import FigureCanvas
|
|
32
|
+
from matplotlib.figure import Figure
|
|
33
|
+
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as \
|
|
34
|
+
NavigationToolbar
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class MyMplCanvas(FigureCanvas):
|
|
38
|
+
"""
|
|
39
|
+
Canvas for the actual plot
|
|
40
|
+
|
|
41
|
+
Attributes
|
|
42
|
+
----------
|
|
43
|
+
axes : matplotlib subplot
|
|
44
|
+
parent : parent
|
|
45
|
+
reference to the parent routine
|
|
46
|
+
"""
|
|
47
|
+
def __init__(self, parent=None):
|
|
48
|
+
# figure stuff
|
|
49
|
+
fig = Figure()
|
|
50
|
+
self.axes = fig.add_subplot(111)
|
|
51
|
+
self.line = None
|
|
52
|
+
self.ind = None
|
|
53
|
+
# self.background = None
|
|
54
|
+
self.parent = parent
|
|
55
|
+
|
|
56
|
+
FigureCanvas.__init__(self, fig)
|
|
57
|
+
|
|
58
|
+
# self.figure.canvas.mpl_connect('pick_event', self.onpick)
|
|
59
|
+
# self.figure.canvas.mpl_connect('button_release_event',
|
|
60
|
+
# self.button_release_callback)
|
|
61
|
+
# self.figure.canvas.mpl_connect('motion_notify_event',
|
|
62
|
+
# self.motion_notify_callback)
|
|
63
|
+
|
|
64
|
+
# def button_release_callback(self, event):
|
|
65
|
+
# """ mouse button release """
|
|
66
|
+
# if event.inaxes is None:
|
|
67
|
+
# return
|
|
68
|
+
# if event.button != 1:
|
|
69
|
+
# return
|
|
70
|
+
# self.ind = None
|
|
71
|
+
|
|
72
|
+
# def motion_notify_callback(self, event):
|
|
73
|
+
# """ move mouse """
|
|
74
|
+
# if event.inaxes is None:
|
|
75
|
+
# return
|
|
76
|
+
# if event.button != 1:
|
|
77
|
+
# return
|
|
78
|
+
# if self.ind is None:
|
|
79
|
+
# return
|
|
80
|
+
#
|
|
81
|
+
# y = event.ydata
|
|
82
|
+
# dtmp = self.line.get_data()
|
|
83
|
+
# dtmp[1][self.ind] = y
|
|
84
|
+
# self.line.set_data(dtmp[0], dtmp[1])
|
|
85
|
+
#
|
|
86
|
+
## self.figure.canvas.restore_region(self.background)
|
|
87
|
+
# self.axes.draw_artist(self.line)
|
|
88
|
+
## self.figure.canvas.blit(self.axes.bbox)
|
|
89
|
+
# self.figure.canvas.update()
|
|
90
|
+
|
|
91
|
+
# def onpick(self, event):
|
|
92
|
+
# """ Picker event """
|
|
93
|
+
# if event.mouseevent.inaxes is None:
|
|
94
|
+
# return
|
|
95
|
+
# if event.mouseevent.button != 1:
|
|
96
|
+
# return
|
|
97
|
+
# if event.artist != self.line:
|
|
98
|
+
# return True
|
|
99
|
+
#
|
|
100
|
+
# self.ind = event.ind
|
|
101
|
+
# self.ind = self.ind[len(self.ind) / 2] # get center-ish value
|
|
102
|
+
#
|
|
103
|
+
# return True
|
|
104
|
+
|
|
105
|
+
def update_contour(self, data1):
|
|
106
|
+
""" Update the plot """
|
|
107
|
+
self.figure.clear()
|
|
108
|
+
self.axes = self.figure.add_subplot(111)
|
|
109
|
+
|
|
110
|
+
extent = (data1.tlx, data1.tlx + data1.cols * data1.xdim,
|
|
111
|
+
data1.tly - data1.rows * data1.ydim, data1.tly)
|
|
112
|
+
|
|
113
|
+
cdat = data1.data + 1
|
|
114
|
+
csp = self.axes.imshow(cdat, cmap=plt.cm.jet, extent=extent)
|
|
115
|
+
vals = np.unique(cdat)
|
|
116
|
+
vals = vals.compressed()
|
|
117
|
+
bnds = (vals - 0.5).tolist() + [vals.max() + .5]
|
|
118
|
+
self.axes.figure.colorbar(csp, boundaries=bnds, values=vals,
|
|
119
|
+
ticks=vals)
|
|
120
|
+
|
|
121
|
+
# self.axes.set_title('Data')
|
|
122
|
+
self.axes.set_xlabel("Eastings")
|
|
123
|
+
self.axes.set_ylabel("Northings")
|
|
124
|
+
self.figure.canvas.draw()
|
|
125
|
+
|
|
126
|
+
def update_raster(self, data1, data2=None):
|
|
127
|
+
""" Update the plot """
|
|
128
|
+
self.figure.clear()
|
|
129
|
+
self.axes = self.figure.add_subplot(111)
|
|
130
|
+
|
|
131
|
+
extent = (data1.tlx, data1.tlx + data1.cols * data1.xdim,
|
|
132
|
+
data1.tly - data1.rows * data1.ydim, data1.tly)
|
|
133
|
+
|
|
134
|
+
rdata = self.axes.imshow(data1.data, extent=extent,
|
|
135
|
+
interpolation='nearest')
|
|
136
|
+
|
|
137
|
+
if data2 is not None:
|
|
138
|
+
self.axes.plot(data2.xdata, data2.ydata, '.')
|
|
139
|
+
|
|
140
|
+
cbar = self.figure.colorbar(rdata)
|
|
141
|
+
try:
|
|
142
|
+
cbar.set_label(data1.units)
|
|
143
|
+
except AttributeError:
|
|
144
|
+
pass
|
|
145
|
+
self.axes.set_xlabel("Eastings")
|
|
146
|
+
self.axes.set_ylabel("Northings")
|
|
147
|
+
self.figure.canvas.draw()
|
|
148
|
+
|
|
149
|
+
def update_membership(self, data1, mem):
|
|
150
|
+
""" Update the plot """
|
|
151
|
+
self.figure.clear()
|
|
152
|
+
self.axes = self.figure.add_subplot(111)
|
|
153
|
+
|
|
154
|
+
extent = (data1.tlx, data1.tlx + data1.cols * data1.xdim,
|
|
155
|
+
data1.tly - data1.rows * data1.ydim, data1.tly)
|
|
156
|
+
|
|
157
|
+
rdata = self.axes.imshow(data1.memdat[mem], extent=extent)
|
|
158
|
+
self.figure.colorbar(rdata)
|
|
159
|
+
# self.axes.set_title('Data')
|
|
160
|
+
self.axes.set_xlabel("Eastings")
|
|
161
|
+
self.axes.set_ylabel("Northings")
|
|
162
|
+
self.figure.canvas.draw()
|
|
163
|
+
|
|
164
|
+
def update_scatter(self, x, y):
|
|
165
|
+
""" Update the plot """
|
|
166
|
+
self.figure.clear()
|
|
167
|
+
self.axes = self.figure.add_subplot(111)
|
|
168
|
+
|
|
169
|
+
xmin = min(x) - 0.1 * np.ptp(x)
|
|
170
|
+
xmax = max(x) + 0.1 * np.ptp(x)
|
|
171
|
+
ymin = min(y) - 0.1 * np.ptp(y)
|
|
172
|
+
ymax = max(y) + 0.1 * np.ptp(y)
|
|
173
|
+
|
|
174
|
+
self.axes.scatter(x, y)
|
|
175
|
+
self.axes.axis([xmin, xmax, ymin, ymax])
|
|
176
|
+
self.axes.set_xlabel("Number of Classes")
|
|
177
|
+
self.figure.canvas.draw()
|
|
178
|
+
|
|
179
|
+
def update_wireframe(self, x, y, z):
|
|
180
|
+
""" Update the plot """
|
|
181
|
+
self.figure.clear()
|
|
182
|
+
self.axes = self.figure.add_subplot(111, projection='3d')
|
|
183
|
+
self.axes.plot_wireframe(x, y, z)
|
|
184
|
+
self.axes.set_title('log(Objective Function)')
|
|
185
|
+
self.axes.set_xlabel("Number of Classes")
|
|
186
|
+
self.axes.set_ylabel("Iteration")
|
|
187
|
+
self.figure.canvas.draw()
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class GraphWindow(QtGui.QDialog):
|
|
191
|
+
"""
|
|
192
|
+
Graph Window
|
|
193
|
+
|
|
194
|
+
Attributes
|
|
195
|
+
----------
|
|
196
|
+
parent : parent
|
|
197
|
+
reference to the parent routine
|
|
198
|
+
"""
|
|
199
|
+
def __init__(self, parent=None):
|
|
200
|
+
QtGui.QDialog.__init__(self, parent=None)
|
|
201
|
+
self.parent = parent
|
|
202
|
+
|
|
203
|
+
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
|
204
|
+
self.setWindowTitle("Graph Window")
|
|
205
|
+
|
|
206
|
+
vbl = QtGui.QVBoxLayout(self) # self is where layout is assigned
|
|
207
|
+
hbl = QtGui.QHBoxLayout()
|
|
208
|
+
self.mmc = MyMplCanvas(self)
|
|
209
|
+
mpl_toolbar = NavigationToolbar(self.mmc, self.parent)
|
|
210
|
+
|
|
211
|
+
self.combobox1 = QtGui.QComboBox()
|
|
212
|
+
self.combobox2 = QtGui.QComboBox()
|
|
213
|
+
self.label1 = QtGui.QLabel()
|
|
214
|
+
self.label2 = QtGui.QLabel()
|
|
215
|
+
|
|
216
|
+
self.label1.setText('Bands:')
|
|
217
|
+
self.label2.setText('Bands:')
|
|
218
|
+
|
|
219
|
+
hbl.addWidget(self.label1)
|
|
220
|
+
hbl.addWidget(self.combobox1)
|
|
221
|
+
hbl.addWidget(self.label2)
|
|
222
|
+
hbl.addWidget(self.combobox2)
|
|
223
|
+
|
|
224
|
+
vbl.addWidget(self.mmc)
|
|
225
|
+
vbl.addWidget(mpl_toolbar)
|
|
226
|
+
vbl.addLayout(hbl)
|
|
227
|
+
|
|
228
|
+
self.setFocus()
|
|
229
|
+
|
|
230
|
+
self.combobox1.currentIndexChanged.connect(self.change_band)
|
|
231
|
+
self.combobox2.currentIndexChanged.connect(self.change_band)
|
|
232
|
+
|
|
233
|
+
def change_band(self):
|
|
234
|
+
""" Combo box to choose band """
|
|
235
|
+
pass
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class PlotRaster(GraphWindow):
|
|
239
|
+
"""
|
|
240
|
+
Plot Raster Class
|
|
241
|
+
|
|
242
|
+
Attributes
|
|
243
|
+
----------
|
|
244
|
+
parent : parent
|
|
245
|
+
reference to the parent routine
|
|
246
|
+
indata : dictionary
|
|
247
|
+
dictionary of input datasets
|
|
248
|
+
"""
|
|
249
|
+
def __init__(self, parent):
|
|
250
|
+
GraphWindow.__init__(self, parent)
|
|
251
|
+
self.label2.hide()
|
|
252
|
+
self.combobox2.hide()
|
|
253
|
+
self.indata = {}
|
|
254
|
+
self.parent = parent
|
|
255
|
+
|
|
256
|
+
def change_band(self):
|
|
257
|
+
""" Combo box to choose band """
|
|
258
|
+
i = self.combobox1.currentIndex()
|
|
259
|
+
data2 = None
|
|
260
|
+
if 'Point' in self.indata:
|
|
261
|
+
data2 = self.indata['Point'][0]
|
|
262
|
+
if 'Raster' in self.indata:
|
|
263
|
+
data = self.indata['Raster']
|
|
264
|
+
self.mmc.update_raster(data[i], data2)
|
|
265
|
+
elif 'Cluster' in self.indata:
|
|
266
|
+
data = self.indata['Cluster']
|
|
267
|
+
self.mmc.update_contour(data[i])
|
|
268
|
+
elif 'ProfPic' in self.indata:
|
|
269
|
+
data = self.indata['ProfPic']
|
|
270
|
+
self.mmc.update_rgb(data[i])
|
|
271
|
+
|
|
272
|
+
def run(self):
|
|
273
|
+
""" Run """
|
|
274
|
+
self.show()
|
|
275
|
+
if 'Raster' in self.indata:
|
|
276
|
+
data = self.indata['Raster']
|
|
277
|
+
elif 'Cluster' in self.indata:
|
|
278
|
+
data = self.indata['Cluster']
|
|
279
|
+
elif 'ProfPic' in self.indata:
|
|
280
|
+
data = self.indata['ProfPic']
|
|
281
|
+
|
|
282
|
+
for i in data:
|
|
283
|
+
self.combobox1.addItem(i.dataid)
|
|
284
|
+
self.change_band()
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class PlotMembership(GraphWindow):
|
|
288
|
+
"""
|
|
289
|
+
Plot Fuzzy Membership data.
|
|
290
|
+
|
|
291
|
+
Attributes
|
|
292
|
+
----------
|
|
293
|
+
parent : parent
|
|
294
|
+
reference to the parent routine
|
|
295
|
+
indata : dictionary
|
|
296
|
+
dictionary of input datasets
|
|
297
|
+
"""
|
|
298
|
+
def __init__(self, parent):
|
|
299
|
+
GraphWindow.__init__(self, parent)
|
|
300
|
+
self.indata = {}
|
|
301
|
+
self.parent = parent
|
|
302
|
+
|
|
303
|
+
def change_band(self):
|
|
304
|
+
""" Combo box to choose band """
|
|
305
|
+
data = self.indata['Cluster']
|
|
306
|
+
i = self.combobox1.currentIndex()
|
|
307
|
+
self.combobox2.clear()
|
|
308
|
+
self.combobox2.currentIndexChanged.disconnect()
|
|
309
|
+
|
|
310
|
+
for j in range(data[i].no_clusters):
|
|
311
|
+
self.combobox2.addItem('Membership Map for Cluster ' + str(j + 1))
|
|
312
|
+
|
|
313
|
+
self.combobox2.currentIndexChanged.connect(self.change_band_two)
|
|
314
|
+
self.change_band_two()
|
|
315
|
+
|
|
316
|
+
def run(self):
|
|
317
|
+
""" Run """
|
|
318
|
+
data = self.indata['Cluster']
|
|
319
|
+
if len(data[0].memdat) == 0:
|
|
320
|
+
return
|
|
321
|
+
|
|
322
|
+
self.show()
|
|
323
|
+
for i in data:
|
|
324
|
+
self.combobox1.addItem(i.dataid)
|
|
325
|
+
|
|
326
|
+
self.change_band()
|
|
327
|
+
|
|
328
|
+
def change_band_two(self):
|
|
329
|
+
""" Combo box to choose band """
|
|
330
|
+
data = self.indata['Cluster']
|
|
331
|
+
|
|
332
|
+
i = self.combobox1.currentIndex()
|
|
333
|
+
j = self.combobox2.currentIndex()
|
|
334
|
+
|
|
335
|
+
self.mmc.update_membership(data[i], j)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class PlotVRCetc(GraphWindow):
|
|
339
|
+
"""
|
|
340
|
+
Plot VRC, NCE, OBJ and XBI
|
|
341
|
+
|
|
342
|
+
Attributes
|
|
343
|
+
----------
|
|
344
|
+
parent : parent
|
|
345
|
+
reference to the parent routine
|
|
346
|
+
indata : dictionary
|
|
347
|
+
dictionary of input datasets
|
|
348
|
+
"""
|
|
349
|
+
def __init__(self, parent):
|
|
350
|
+
GraphWindow.__init__(self, parent)
|
|
351
|
+
self.combobox2.hide()
|
|
352
|
+
self.label2.hide()
|
|
353
|
+
self.parent = parent
|
|
354
|
+
self.indata = {}
|
|
355
|
+
|
|
356
|
+
def change_band(self):
|
|
357
|
+
""" Combo box to choose band """
|
|
358
|
+
data = self.indata['Cluster']
|
|
359
|
+
|
|
360
|
+
j = str(self.combobox1.currentText())
|
|
361
|
+
|
|
362
|
+
if j == 'Objective Function' and data[0].obj_fcn is not None:
|
|
363
|
+
x = len(data)
|
|
364
|
+
y = 0
|
|
365
|
+
for i in data:
|
|
366
|
+
y = max(y, len(i.obj_fcn))
|
|
367
|
+
|
|
368
|
+
z = np.zeros([x, y])
|
|
369
|
+
x = list(range(x))
|
|
370
|
+
y = list(range(y))
|
|
371
|
+
|
|
372
|
+
for i in x:
|
|
373
|
+
for j in range(len(data[i].obj_fcn)):
|
|
374
|
+
z[i, j] = data[i].obj_fcn[j]
|
|
375
|
+
|
|
376
|
+
for i in x:
|
|
377
|
+
z[i][z[i] == 0] = z[i][z[i] != 0].min()
|
|
378
|
+
|
|
379
|
+
x, y = np.meshgrid(x, y)
|
|
380
|
+
x += data[0].no_clusters
|
|
381
|
+
self.mmc.update_wireframe(x.T, y.T, np.log(z))
|
|
382
|
+
|
|
383
|
+
if j == 'Variance Ratio Criterion' and data[0].vrc is not None:
|
|
384
|
+
x = [k.no_clusters for k in data]
|
|
385
|
+
y = [k.vrc for k in data]
|
|
386
|
+
self.mmc.update_scatter(x, y)
|
|
387
|
+
if j == 'Normalized Class Entropy' and data[0].nce is not None:
|
|
388
|
+
x = [k.no_clusters for k in data]
|
|
389
|
+
y = [k.nce for k in data]
|
|
390
|
+
self.mmc.update_scatter(x, y)
|
|
391
|
+
if j == 'Xie-Beni Index' and data[0].xbi is not None:
|
|
392
|
+
x = [k.no_clusters for k in data]
|
|
393
|
+
y = [k.xbi for k in data]
|
|
394
|
+
self.mmc.update_scatter(x, y)
|
|
395
|
+
|
|
396
|
+
def run(self):
|
|
397
|
+
""" Run """
|
|
398
|
+
items = []
|
|
399
|
+
data = self.indata['Cluster']
|
|
400
|
+
|
|
401
|
+
if data[0].obj_fcn is not None:
|
|
402
|
+
items += ['Objective Function']
|
|
403
|
+
|
|
404
|
+
if data[0].vrc is not None:
|
|
405
|
+
items += ['Variance Ratio Criterion']
|
|
406
|
+
|
|
407
|
+
if data[0].nce is not None:
|
|
408
|
+
items += ['Normalized Class Entropy']
|
|
409
|
+
|
|
410
|
+
if data[0].xbi is not None:
|
|
411
|
+
items += ['Xie-Beni Index']
|
|
412
|
+
|
|
413
|
+
if len(items) == 0:
|
|
414
|
+
self.parent.showprocesslog('Your dataset does not qualify')
|
|
415
|
+
return
|
|
416
|
+
|
|
417
|
+
self.combobox1.addItems(items)
|
|
418
|
+
|
|
419
|
+
self.label1.setText('Graph Type:')
|
|
420
|
+
self.combobox1.setCurrentIndex(0)
|
|
421
|
+
self.show()
|