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,425 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: tab_ddisp.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
|
+
""" Data Display Routines found on Data Display Tab"""
|
|
26
|
+
|
|
27
|
+
from PyQt4 import QtGui, QtCore
|
|
28
|
+
import numpy as np
|
|
29
|
+
# from matplotlib.figure import Figure
|
|
30
|
+
import matplotlib.cm as cm
|
|
31
|
+
import matplotlib.pyplot as plt
|
|
32
|
+
import matplotlib.colors as clrs
|
|
33
|
+
from matplotlib.backends.backend_qt4agg import FigureCanvas
|
|
34
|
+
from matplotlib.backends.backend_qt4agg import \
|
|
35
|
+
NavigationToolbar2QT as NavigationToolbar
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class DataDisplay(object):
|
|
39
|
+
""" Widget class to call the main interface """
|
|
40
|
+
def __init__(self, parent):
|
|
41
|
+
self.parent = parent
|
|
42
|
+
self.lmod1 = parent.lmod1
|
|
43
|
+
self.grid_stretch = 'linear'
|
|
44
|
+
self.grid1 = self.lmod1.griddata['Calculated Magnetics']
|
|
45
|
+
self.grid2 = self.lmod1.griddata['Calculated Gravity']
|
|
46
|
+
self.grid1txt = 'Calculated Magnetics'
|
|
47
|
+
self.grid2txt = 'Calculated Gravity'
|
|
48
|
+
|
|
49
|
+
self.userint = QtGui.QWidget()
|
|
50
|
+
self.mmc = MyMplCanvas(len(self.lmod1.custprofx))
|
|
51
|
+
self.mpl_toolbar = NavigationToolbar(self.mmc, self.userint)
|
|
52
|
+
|
|
53
|
+
self.ddisp_plot = self.mmc
|
|
54
|
+
self.sb_profnum = QtGui.QSpinBox()
|
|
55
|
+
self.label_profile_xy = QtGui.QLabel()
|
|
56
|
+
self.hslider_profile = QtGui.QSlider()
|
|
57
|
+
self.hslider_grid = QtGui.QSlider()
|
|
58
|
+
self.combo_grid1 = QtGui.QComboBox()
|
|
59
|
+
self.combo_grid2 = QtGui.QComboBox()
|
|
60
|
+
self.rb_ew = QtGui.QRadioButton()
|
|
61
|
+
self.rb_ns = QtGui.QRadioButton()
|
|
62
|
+
|
|
63
|
+
self.setupui()
|
|
64
|
+
|
|
65
|
+
def setupui(self):
|
|
66
|
+
""" Setup UI """
|
|
67
|
+
gtmp = ['Calculated Magnetics', 'Calculated Gravity']
|
|
68
|
+
gridlayout = QtGui.QGridLayout(self.userint)
|
|
69
|
+
groupbox = QtGui.QGroupBox()
|
|
70
|
+
verticallayout = QtGui.QVBoxLayout(groupbox)
|
|
71
|
+
|
|
72
|
+
sizepolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
|
|
73
|
+
QtGui.QSizePolicy.Fixed)
|
|
74
|
+
|
|
75
|
+
self.label_profile_xy.setSizePolicy(sizepolicy)
|
|
76
|
+
self.hslider_profile.setSizePolicy(sizepolicy)
|
|
77
|
+
self.hslider_profile.setOrientation(QtCore.Qt.Horizontal)
|
|
78
|
+
self.hslider_grid.setOrientation(QtCore.Qt.Horizontal)
|
|
79
|
+
self.rb_ew.setChecked(True)
|
|
80
|
+
self.sb_profnum.setFixedWidth(220)
|
|
81
|
+
self.sb_profnum.setMaximum(self.lmod1.numy-1)
|
|
82
|
+
self.combo_grid1.addItems(gtmp)
|
|
83
|
+
self.combo_grid1.setCurrentIndex(0) # set to mag
|
|
84
|
+
self.combo_grid2.addItems(gtmp)
|
|
85
|
+
self.combo_grid2.setCurrentIndex(1) # set to grav
|
|
86
|
+
|
|
87
|
+
self.sb_profnum.setPrefix("Profile: ")
|
|
88
|
+
self.label_profile_xy.setText("Easting:")
|
|
89
|
+
groupbox.setTitle("Profile Orientation")
|
|
90
|
+
self.rb_ew.setText("Profile is W-E")
|
|
91
|
+
self.rb_ns.setText("Profile is S-N")
|
|
92
|
+
|
|
93
|
+
verticallayout.addWidget(self.rb_ew)
|
|
94
|
+
verticallayout.addWidget(self.rb_ns)
|
|
95
|
+
|
|
96
|
+
gridlayout.addWidget(self.mpl_toolbar, 0, 0, 1, 1)
|
|
97
|
+
gridlayout.addWidget(self.ddisp_plot, 1, 0, 8, 1)
|
|
98
|
+
gridlayout.addWidget(self.hslider_grid, 9, 0, 1, 1)
|
|
99
|
+
gridlayout.addWidget(self.sb_profnum, 0, 1, 1, 1)
|
|
100
|
+
gridlayout.addWidget(self.label_profile_xy, 1, 1, 1, 1)
|
|
101
|
+
gridlayout.addWidget(self.hslider_profile, 2, 1, 1, 1)
|
|
102
|
+
gridlayout.addWidget(groupbox, 3, 1, 1, 1)
|
|
103
|
+
gridlayout.addWidget(self.combo_grid2, 4, 1, 1, 1)
|
|
104
|
+
gridlayout.addWidget(self.combo_grid1, 5, 1, 1, 1)
|
|
105
|
+
|
|
106
|
+
# Buttons
|
|
107
|
+
self.combo_grid1.currentIndexChanged.connect(self.combo1)
|
|
108
|
+
self.combo_grid2.currentIndexChanged.connect(self.combo2)
|
|
109
|
+
self.hslider_grid.sliderMoved.connect(self.hs_grid)
|
|
110
|
+
self.hslider_profile.sliderMoved.connect(self.profnum)
|
|
111
|
+
self.sb_profnum.valueChanged.connect(self.profnum)
|
|
112
|
+
self.rb_ew.clicked.connect(self.prof_dir)
|
|
113
|
+
self.rb_ns.clicked.connect(self.prof_dir)
|
|
114
|
+
|
|
115
|
+
def combo1(self):
|
|
116
|
+
""" Combo box to choose grid 1 """
|
|
117
|
+
self.mpl_toolbar.home()
|
|
118
|
+
ctxt = str(self.combo_grid1.currentText())
|
|
119
|
+
|
|
120
|
+
reg = 0
|
|
121
|
+
if ctxt == 'Calculated Gravity':
|
|
122
|
+
reg = self.lmod1.gregional
|
|
123
|
+
|
|
124
|
+
self.grid1txt = ctxt
|
|
125
|
+
self.grid1 = self.lmod1.griddata[ctxt]
|
|
126
|
+
|
|
127
|
+
self.mmc.init_grid1(self.grid1, reg, ctxt)
|
|
128
|
+
|
|
129
|
+
def combo2(self):
|
|
130
|
+
""" Combo box to choose grid 2 """
|
|
131
|
+
self.mpl_toolbar.home()
|
|
132
|
+
ctxt = str(self.combo_grid2.currentText())
|
|
133
|
+
|
|
134
|
+
reg = 0
|
|
135
|
+
if ctxt == 'Calculated Gravity':
|
|
136
|
+
reg = self.lmod1.gregional
|
|
137
|
+
|
|
138
|
+
self.grid2txt = ctxt
|
|
139
|
+
self.grid2 = self.lmod1.griddata[ctxt]
|
|
140
|
+
self.mmc.init_grid2(self.grid2, reg, ctxt)
|
|
141
|
+
# Needed to force the drawing of colorbar
|
|
142
|
+
QtGui.QApplication.processEvents()
|
|
143
|
+
self.hs_grid()
|
|
144
|
+
|
|
145
|
+
def hs_grid(self):
|
|
146
|
+
""" Horizontal slider used to show grid1 and grid2 """
|
|
147
|
+
ctxt = str(self.combo_grid1.currentText())
|
|
148
|
+
|
|
149
|
+
self.grid1 = self.lmod1.griddata[ctxt]
|
|
150
|
+
hsgval = self.hslider_grid.sliderPosition()
|
|
151
|
+
perc = hsgval / float(self.hslider_grid.maximum())
|
|
152
|
+
self.mmc.slide_grid1(perc)
|
|
153
|
+
|
|
154
|
+
def prof_dir(self):
|
|
155
|
+
""" Radio button for EW or NS profiles """
|
|
156
|
+
self.sb_profnum.setValue(0.0)
|
|
157
|
+
|
|
158
|
+
if self.rb_ew.isChecked():
|
|
159
|
+
self.sb_profnum.setMaximum(self.lmod1.numy-1)
|
|
160
|
+
self.hslider_profile.setMaximum(self.lmod1.numy-1)
|
|
161
|
+
self.lmod1.is_ew = True
|
|
162
|
+
elif self.rb_ns.isChecked():
|
|
163
|
+
self.sb_profnum.setMaximum(self.lmod1.numx-1)
|
|
164
|
+
self.hslider_profile.setMaximum(self.lmod1.numx-1)
|
|
165
|
+
self.lmod1.is_ew = False
|
|
166
|
+
|
|
167
|
+
def profnum(self):
|
|
168
|
+
""" Routine to change a profile from spinbox"""
|
|
169
|
+
|
|
170
|
+
if self.hslider_profile.isSliderDown():
|
|
171
|
+
self.sb_profnum.setValue(self.hslider_profile.sliderPosition())
|
|
172
|
+
else:
|
|
173
|
+
self.hslider_profile.setValue(self.sb_profnum.value())
|
|
174
|
+
|
|
175
|
+
self.lmod1.curprof = self.sb_profnum.value()
|
|
176
|
+
|
|
177
|
+
xrng = np.array(self.lmod1.xrange)
|
|
178
|
+
yrng = np.array(self.lmod1.yrange)
|
|
179
|
+
|
|
180
|
+
ytmp = [self.lmod1.curprof*self.lmod1.dxy+self.lmod1.dxy/2+yrng[0]]
|
|
181
|
+
xtmp = [self.lmod1.curprof*self.lmod1.dxy+self.lmod1.dxy/2+xrng[0]]
|
|
182
|
+
|
|
183
|
+
xtmp = np.array([xtmp, xtmp])
|
|
184
|
+
ytmp = np.array([ytmp, ytmp])
|
|
185
|
+
|
|
186
|
+
if self.rb_ew.isChecked():
|
|
187
|
+
xys = self.lmod1.yrange[0]+self.lmod1.curprof*self.lmod1.dxy
|
|
188
|
+
self.label_profile_xy.setText('Northing: '+str(xys))
|
|
189
|
+
self.mmc.init_line(self.lmod1.xrange, [xys, xys], self.lmod1)
|
|
190
|
+
elif self.rb_ns.isChecked():
|
|
191
|
+
xys = self.lmod1.xrange[0]+self.lmod1.curprof*self.lmod1.dxy
|
|
192
|
+
self.label_profile_xy.setText('Easting: '+str(xys))
|
|
193
|
+
self.mmc.init_line([xys, xys], self.lmod1.yrange, self.lmod1)
|
|
194
|
+
|
|
195
|
+
def update_combos(self):
|
|
196
|
+
""" Update the combos """
|
|
197
|
+
tmp = list(self.lmod1.griddata.keys())
|
|
198
|
+
|
|
199
|
+
self.combo_grid1.blockSignals(True)
|
|
200
|
+
self.combo_grid2.blockSignals(True)
|
|
201
|
+
|
|
202
|
+
self.combo_grid1.clear()
|
|
203
|
+
self.combo_grid1.addItems(tmp)
|
|
204
|
+
self.combo_grid1.setCurrentIndex(tmp.index(self.grid1txt))
|
|
205
|
+
|
|
206
|
+
self.combo_grid2.clear()
|
|
207
|
+
self.combo_grid2.addItems(tmp)
|
|
208
|
+
self.combo_grid2.setCurrentIndex(tmp.index(self.grid2txt))
|
|
209
|
+
|
|
210
|
+
self.combo_grid1.blockSignals(False)
|
|
211
|
+
self.combo_grid2.blockSignals(False)
|
|
212
|
+
|
|
213
|
+
def tab_activate(self):
|
|
214
|
+
""" Runs when the tab is activated """
|
|
215
|
+
self.lmod1 = self.parent.lmod1
|
|
216
|
+
self.mmc.set_limits(self.lmod1)
|
|
217
|
+
self.mmc.update_ncust(len(self.lmod1.custprofx))
|
|
218
|
+
self.update_combos()
|
|
219
|
+
self.combo2()
|
|
220
|
+
self.combo1()
|
|
221
|
+
|
|
222
|
+
if self.rb_ew.isChecked():
|
|
223
|
+
self.sb_profnum.setMaximum(self.lmod1.numy-1)
|
|
224
|
+
self.hslider_profile.setMaximum(self.lmod1.numy-1)
|
|
225
|
+
self.lmod1.is_ew = True
|
|
226
|
+
elif self.rb_ns.isChecked():
|
|
227
|
+
self.sb_profnum.setMaximum(self.lmod1.numx-1)
|
|
228
|
+
self.hslider_profile.setMaximum(self.lmod1.numx-1)
|
|
229
|
+
self.lmod1.is_ew = False
|
|
230
|
+
self.sb_profnum.setValue(self.lmod1.curprof)
|
|
231
|
+
self.profnum()
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class MyMplCanvas(FigureCanvas):
|
|
235
|
+
"""
|
|
236
|
+
Canvas for the actual plot
|
|
237
|
+
|
|
238
|
+
Attributes
|
|
239
|
+
----------
|
|
240
|
+
"""
|
|
241
|
+
def __init__(self, ncust=1):
|
|
242
|
+
# figure stuff
|
|
243
|
+
# fig = Figure()
|
|
244
|
+
fig = plt.figure()
|
|
245
|
+
|
|
246
|
+
self.cbar = cm.jet
|
|
247
|
+
self.gmode = None
|
|
248
|
+
self.xlims = None
|
|
249
|
+
self.ylims = None
|
|
250
|
+
|
|
251
|
+
self.axes = fig.add_subplot(111)
|
|
252
|
+
self.axes.xaxis.set_label_text("Eastings (m)")
|
|
253
|
+
self.axes.yaxis.set_label_text("Northings (m)")
|
|
254
|
+
|
|
255
|
+
FigureCanvas.__init__(self, fig)
|
|
256
|
+
|
|
257
|
+
# FigureCanvas.setSizePolicy(self,
|
|
258
|
+
# QtGui.QSizePolicy.Expanding,
|
|
259
|
+
# QtGui.QSizePolicy.Expanding)
|
|
260
|
+
# FigureCanvas.updateGeometry(self)
|
|
261
|
+
|
|
262
|
+
dat = np.zeros([100, 100])
|
|
263
|
+
|
|
264
|
+
self.ims2 = plt.imshow(dat, cmap=self.cbar, interpolation='nearest')
|
|
265
|
+
self.ims = plt.imshow(self.cbar(dat), interpolation='nearest')
|
|
266
|
+
self.ims2.set_clim(0, 1)
|
|
267
|
+
self.ibar = self.figure.colorbar(self.ims, fraction=0.025, pad=0.1)
|
|
268
|
+
self.ibar2 = self.figure.colorbar(self.ims2, cax=self.ibar.ax.twinx())
|
|
269
|
+
self.ibar.ax.set_aspect('auto')
|
|
270
|
+
self.ibar.set_label('')
|
|
271
|
+
self.ibar2.set_label('')
|
|
272
|
+
self.ibar.ax.yaxis.set_label_position('left')
|
|
273
|
+
|
|
274
|
+
# self.ibar2.ax.yaxis.set_ticks_position('left')
|
|
275
|
+
|
|
276
|
+
self.figure.canvas.draw()
|
|
277
|
+
self.bbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
|
|
278
|
+
self.lbbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
|
|
279
|
+
|
|
280
|
+
self.prf = self.axes.plot([0, 1], [0, 1])
|
|
281
|
+
for _ in range(ncust):
|
|
282
|
+
self.prf += self.axes.plot([0, 1], [0, 1])
|
|
283
|
+
|
|
284
|
+
self.figure.canvas.draw()
|
|
285
|
+
|
|
286
|
+
self.gcol1 = self.cbar(dat)
|
|
287
|
+
|
|
288
|
+
def update_ncust(self, ncust):
|
|
289
|
+
""" Updates mumber of custom profiles """
|
|
290
|
+
diff = ncust-(len(self.prf)-1)
|
|
291
|
+
if diff < 1:
|
|
292
|
+
return
|
|
293
|
+
for _ in range(diff):
|
|
294
|
+
self.prf += self.axes.plot([0, 1], [0, 1])
|
|
295
|
+
|
|
296
|
+
def init_grid1(self, dat1, reg=0, lbl=''):
|
|
297
|
+
""" Updates the upper single color map """
|
|
298
|
+
try:
|
|
299
|
+
if dat1.units != '':
|
|
300
|
+
lbl += ' ('+dat1.units+')'
|
|
301
|
+
except AttributeError:
|
|
302
|
+
pass
|
|
303
|
+
self.ibar.set_label(lbl)
|
|
304
|
+
|
|
305
|
+
dmin = dat1.data.min()+reg
|
|
306
|
+
dmax = dat1.data.max()+reg
|
|
307
|
+
if dmin == dmax:
|
|
308
|
+
dmax = dmin+1
|
|
309
|
+
self.ims.set_clim(dmin, dmax)
|
|
310
|
+
|
|
311
|
+
# cnorm = clrs.Normalize()(dat1.data[::-1]-reg)
|
|
312
|
+
cnorm = clrs.Normalize()(dat1.data+reg)
|
|
313
|
+
cnorm.data[cnorm.mask] = 0.0
|
|
314
|
+
tmp = self.cbar(cnorm)
|
|
315
|
+
|
|
316
|
+
self.ims.set_data(tmp)
|
|
317
|
+
self.ims.set_extent(self.dat_extent(dat1))
|
|
318
|
+
if self.xlims is not None:
|
|
319
|
+
self.axes.set_xlim(self.xlims)
|
|
320
|
+
self.axes.set_ylim(self.ylims)
|
|
321
|
+
|
|
322
|
+
self.figure.canvas.draw()
|
|
323
|
+
|
|
324
|
+
def init_grid2(self, dat2, reg=0, lbl=''):
|
|
325
|
+
""" Updates the lower single color map. It has to disable the upper map
|
|
326
|
+
while doing so - in order to update the blit """
|
|
327
|
+
try:
|
|
328
|
+
if dat2.units != '':
|
|
329
|
+
lbl += ' ('+dat2.units+')'
|
|
330
|
+
except AttributeError:
|
|
331
|
+
pass
|
|
332
|
+
self.ibar2.set_label(lbl)
|
|
333
|
+
|
|
334
|
+
for i in self.prf:
|
|
335
|
+
i.set_visible(False)
|
|
336
|
+
self.ims.set_visible(False)
|
|
337
|
+
# self.ims2.set_data(dat2.data[::-1]+reg)
|
|
338
|
+
self.ims2.set_data(dat2.data+reg)
|
|
339
|
+
self.ims2.set_extent(self.dat_extent(dat2))
|
|
340
|
+
if self.xlims is not None:
|
|
341
|
+
self.axes.set_xlim(self.xlims)
|
|
342
|
+
self.axes.set_ylim(self.ylims)
|
|
343
|
+
|
|
344
|
+
dmin = dat2.data.min()+reg
|
|
345
|
+
dmax = dat2.data.max()+reg
|
|
346
|
+
if dmin == dmax:
|
|
347
|
+
dmax = dmin+1
|
|
348
|
+
self.ims2.set_clim(dmin, dmax)
|
|
349
|
+
|
|
350
|
+
self.figure.canvas.draw()
|
|
351
|
+
self.bbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
|
|
352
|
+
self.ims.set_visible(True)
|
|
353
|
+
self.lbbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
|
|
354
|
+
for i in self.prf:
|
|
355
|
+
i.set_visible(True)
|
|
356
|
+
|
|
357
|
+
def slide_grid1(self, perc=0.0):
|
|
358
|
+
""" Slider """
|
|
359
|
+
self.ims.set_alpha(perc)
|
|
360
|
+
self.figure.canvas.restore_region(self.bbox)
|
|
361
|
+
self.axes.draw_artist(self.ims)
|
|
362
|
+
# self.figure.canvas.blit(self.axes.bbox)
|
|
363
|
+
self.figure.canvas.update()
|
|
364
|
+
|
|
365
|
+
self.lbbox = self.figure.canvas.copy_from_bbox(self.axes.bbox)
|
|
366
|
+
for i in self.prf:
|
|
367
|
+
self.axes.draw_artist(i)
|
|
368
|
+
# self.figure.canvas.blit(self.axes.bbox)
|
|
369
|
+
self.figure.canvas.update()
|
|
370
|
+
|
|
371
|
+
def init_line(self, xrng, yrng, lmod):
|
|
372
|
+
""" Updates the line position """
|
|
373
|
+
kmdiv = 1.
|
|
374
|
+
if self.axes.xaxis.get_label_text().find('km') > -1:
|
|
375
|
+
xrng = [xrng[0]/1000., xrng[1]/1000.]
|
|
376
|
+
yrng = [yrng[0]/1000., yrng[1]/1000.]
|
|
377
|
+
kmdiv = 1000.
|
|
378
|
+
|
|
379
|
+
self.prf[0].set_data([xrng, yrng])
|
|
380
|
+
for i in range(len(lmod.custprofx)):
|
|
381
|
+
self.prf[i+1].set_data([[lmod.custprofx[i][0]/kmdiv,
|
|
382
|
+
lmod.custprofx[i][1]/kmdiv],
|
|
383
|
+
[lmod.custprofy[i][0]/kmdiv,
|
|
384
|
+
lmod.custprofy[i][1]/kmdiv]])
|
|
385
|
+
self.figure.canvas.restore_region(self.lbbox)
|
|
386
|
+
self.axes.draw_artist(self.prf[0])
|
|
387
|
+
for i in range(len(lmod.custprofx)):
|
|
388
|
+
self.axes.draw_artist(self.prf[i+1])
|
|
389
|
+
self.figure.canvas.update()
|
|
390
|
+
# self.figure.canvas.blit(self.axes.bbox)
|
|
391
|
+
|
|
392
|
+
def dat_extent(self, dat):
|
|
393
|
+
""" Gets the extent of the dat variable """
|
|
394
|
+
left = dat.tlx
|
|
395
|
+
top = dat.tly
|
|
396
|
+
right = left + dat.cols*dat.xdim
|
|
397
|
+
bottom = top - dat.rows*dat.ydim
|
|
398
|
+
|
|
399
|
+
if False: # (right-left) > 10000 or (top-bottom) > 10000:
|
|
400
|
+
self.axes.xaxis.set_label_text("Eastings (km)")
|
|
401
|
+
self.axes.yaxis.set_label_text("Northings (km)")
|
|
402
|
+
left /= 1000.
|
|
403
|
+
right /= 1000.
|
|
404
|
+
top /= 1000.
|
|
405
|
+
bottom /= 1000.
|
|
406
|
+
else:
|
|
407
|
+
self.axes.xaxis.set_label_text("Eastings (m)")
|
|
408
|
+
self.axes.yaxis.set_label_text("Northings (m)")
|
|
409
|
+
|
|
410
|
+
return (left, right, bottom, top)
|
|
411
|
+
|
|
412
|
+
def set_limits(self, lmod):
|
|
413
|
+
""" Sets limits for the axes """
|
|
414
|
+
left, right = lmod.xrange
|
|
415
|
+
bottom, top = lmod.yrange
|
|
416
|
+
# if (right-left) > 10000 or (top-bottom) > 10000:
|
|
417
|
+
# left /= 1000.
|
|
418
|
+
# right /= 1000.
|
|
419
|
+
# top /= 1000.
|
|
420
|
+
# bottom /= 1000.
|
|
421
|
+
|
|
422
|
+
self.xlims = (left, right)
|
|
423
|
+
self.ylims = (bottom, top)
|
|
424
|
+
self.axes.set_xlim(self.xlims)
|
|
425
|
+
self.axes.set_ylim(self.ylims)
|