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,307 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: menu.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
|
+
""" Raster Menu Routines """
|
|
26
|
+
|
|
27
|
+
from PyQt4 import QtGui
|
|
28
|
+
from . import equation_editor
|
|
29
|
+
from . import smooth
|
|
30
|
+
from . import normalisation
|
|
31
|
+
from . import cooper
|
|
32
|
+
from . import ginterp
|
|
33
|
+
from . import graphs
|
|
34
|
+
from . import show_table
|
|
35
|
+
from . import dataprep
|
|
36
|
+
from . import iodefs
|
|
37
|
+
from . import igrf
|
|
38
|
+
from . import tiltdepth
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class MenuWidget(object):
|
|
42
|
+
"""
|
|
43
|
+
Widget class to call the main interface
|
|
44
|
+
|
|
45
|
+
This widget class creates the raster menus to be found on the main
|
|
46
|
+
interface. Normal as well as context menus are defined here.
|
|
47
|
+
|
|
48
|
+
Attributes
|
|
49
|
+
----------
|
|
50
|
+
parent : MainWidget
|
|
51
|
+
Reference to MainWidget class found in main.py
|
|
52
|
+
"""
|
|
53
|
+
def __init__(self, parent):
|
|
54
|
+
|
|
55
|
+
self.parent = parent
|
|
56
|
+
self.parent.add_to_context('Raster')
|
|
57
|
+
context_menu = self.parent.context_menu
|
|
58
|
+
|
|
59
|
+
# Normal menus
|
|
60
|
+
self.menu = QtGui.QMenu(parent.menubar)
|
|
61
|
+
self.menu.setTitle("Raster")
|
|
62
|
+
parent.menubar.addAction(self.menu.menuAction())
|
|
63
|
+
|
|
64
|
+
self.action_import_data = QtGui.QAction(parent)
|
|
65
|
+
self.action_import_data.setText("Import Raster Data")
|
|
66
|
+
self.menu.addAction(self.action_import_data)
|
|
67
|
+
self.action_import_data.triggered.connect(self.import_data)
|
|
68
|
+
|
|
69
|
+
self.menu.addSeparator()
|
|
70
|
+
|
|
71
|
+
self.action_equation_editor = QtGui.QAction(self.parent)
|
|
72
|
+
self.action_equation_editor.setText("Equation Editor")
|
|
73
|
+
self.menu.addAction(self.action_equation_editor)
|
|
74
|
+
self.action_equation_editor.triggered.connect(self.equation_editor)
|
|
75
|
+
|
|
76
|
+
self.action_smoothing = QtGui.QAction(self.parent)
|
|
77
|
+
self.action_smoothing.setText("Smoothing")
|
|
78
|
+
self.menu.addAction(self.action_smoothing)
|
|
79
|
+
self.action_smoothing.triggered.connect(self.smoothing)
|
|
80
|
+
|
|
81
|
+
self.action_normalisation = QtGui.QAction(self.parent)
|
|
82
|
+
self.action_normalisation.setText("Normalisation")
|
|
83
|
+
self.menu.addAction(self.action_normalisation)
|
|
84
|
+
self.action_normalisation.triggered.connect(self.norm_data)
|
|
85
|
+
|
|
86
|
+
self.action_gradients = QtGui.QAction(self.parent)
|
|
87
|
+
self.action_gradients.setText("Horizontal Gradients")
|
|
88
|
+
self.menu.addAction(self.action_gradients)
|
|
89
|
+
self.action_gradients.triggered.connect(self.gradients)
|
|
90
|
+
|
|
91
|
+
self.action_visibility = QtGui.QAction(self.parent)
|
|
92
|
+
self.action_visibility.setText("Visibility")
|
|
93
|
+
self.menu.addAction(self.action_visibility)
|
|
94
|
+
self.action_visibility.triggered.connect(self.visibility)
|
|
95
|
+
|
|
96
|
+
self.action_tilt = QtGui.QAction(self.parent)
|
|
97
|
+
self.action_tilt.setText("Tilt Angle")
|
|
98
|
+
self.menu.addAction(self.action_tilt)
|
|
99
|
+
self.action_tilt.triggered.connect(self.tilt)
|
|
100
|
+
|
|
101
|
+
self.action_rtp = QtGui.QAction(self.parent)
|
|
102
|
+
self.action_rtp.setText("Reduction to the Pole")
|
|
103
|
+
self.menu.addAction(self.action_rtp)
|
|
104
|
+
self.action_rtp.triggered.connect(self.rtp)
|
|
105
|
+
|
|
106
|
+
self.action_igrf = QtGui.QAction(self.parent)
|
|
107
|
+
self.action_igrf.setText("Calculate IGRF Corrected Data")
|
|
108
|
+
self.menu.addAction(self.action_igrf)
|
|
109
|
+
self.action_igrf.triggered.connect(self.igrf)
|
|
110
|
+
|
|
111
|
+
self.menu.addSeparator()
|
|
112
|
+
|
|
113
|
+
self.action_merge = QtGui.QAction(self.parent)
|
|
114
|
+
self.action_merge.setText("Merge and Resampling")
|
|
115
|
+
self.menu.addAction(self.action_merge)
|
|
116
|
+
self.action_merge.triggered.connect(self.merge)
|
|
117
|
+
|
|
118
|
+
self.action_reproj = QtGui.QAction(self.parent)
|
|
119
|
+
self.action_reproj.setText("Reprojection")
|
|
120
|
+
self.menu.addAction(self.action_reproj)
|
|
121
|
+
self.action_reproj.triggered.connect(self.reproj)
|
|
122
|
+
|
|
123
|
+
self.action_cut_data = QtGui.QAction(self.parent)
|
|
124
|
+
self.action_cut_data.setText("Cut Raster using Polygon")
|
|
125
|
+
self.menu.addAction(self.action_cut_data)
|
|
126
|
+
self.action_cut_data.triggered.connect(self.cut_data)
|
|
127
|
+
|
|
128
|
+
self.menu.addSeparator()
|
|
129
|
+
|
|
130
|
+
self.action_get_prof = QtGui.QAction(self.parent)
|
|
131
|
+
self.action_get_prof.setText("Extract Profile from Raster")
|
|
132
|
+
self.menu.addAction(self.action_get_prof)
|
|
133
|
+
self.action_get_prof.triggered.connect(self.get_prof)
|
|
134
|
+
|
|
135
|
+
self.action_grid = QtGui.QAction(self.parent)
|
|
136
|
+
self.action_grid.setText("Grid Point Data (Linear)")
|
|
137
|
+
self.menu.addAction(self.action_grid)
|
|
138
|
+
self.action_grid.triggered.connect(self.grid)
|
|
139
|
+
|
|
140
|
+
self.menu.addSeparator()
|
|
141
|
+
|
|
142
|
+
self.action_raster_data_interp = QtGui.QAction(self.parent)
|
|
143
|
+
self.action_raster_data_interp.setText("Raster Data Interpretation")
|
|
144
|
+
self.menu.addAction(self.action_raster_data_interp)
|
|
145
|
+
self.action_raster_data_interp.triggered.connect(self.raster_interp)
|
|
146
|
+
|
|
147
|
+
self.action_depth_susc = QtGui.QAction(self.parent)
|
|
148
|
+
self.action_depth_susc.setText("Tilt Depth Interpretation")
|
|
149
|
+
self.menu.addAction(self.action_depth_susc)
|
|
150
|
+
self.action_depth_susc.triggered.connect(self.depth_susc)
|
|
151
|
+
|
|
152
|
+
# Context menus
|
|
153
|
+
context_menu['Raster'].addSeparator()
|
|
154
|
+
|
|
155
|
+
self.action_metadata = QtGui.QAction(self.parent)
|
|
156
|
+
self.action_metadata.setText("Display/Edit Metadata")
|
|
157
|
+
context_menu['Raster'].addAction(self.action_metadata)
|
|
158
|
+
self.action_metadata.triggered.connect(self.metadata)
|
|
159
|
+
|
|
160
|
+
self.action_basic_statistics = QtGui.QAction(self.parent)
|
|
161
|
+
self.action_basic_statistics.setText("Basic Statistics")
|
|
162
|
+
context_menu['Raster'].addAction(self.action_basic_statistics)
|
|
163
|
+
self.action_basic_statistics.triggered.connect(self.basic_stats)
|
|
164
|
+
|
|
165
|
+
self.action_show_raster_data = QtGui.QAction(self.parent)
|
|
166
|
+
self.action_show_raster_data.setText("Show Raster Data")
|
|
167
|
+
context_menu['Raster'].addAction(self.action_show_raster_data)
|
|
168
|
+
self.action_show_raster_data.triggered.connect(self.show_raster_data)
|
|
169
|
+
|
|
170
|
+
self.action_show_surface = QtGui.QAction(self.parent)
|
|
171
|
+
self.action_show_surface.setText("Show Surface")
|
|
172
|
+
context_menu['Raster'].addAction(self.action_show_surface)
|
|
173
|
+
self.action_show_surface.triggered.connect(self.show_surface)
|
|
174
|
+
|
|
175
|
+
self.action_show_scatter_plot = QtGui.QAction(self.parent)
|
|
176
|
+
self.action_show_scatter_plot.setText("Show Hexbin Plot")
|
|
177
|
+
context_menu['Raster'].addAction(self.action_show_scatter_plot)
|
|
178
|
+
self.action_show_scatter_plot.triggered.connect(self.show_scatter_plot)
|
|
179
|
+
|
|
180
|
+
self.action_show_histogram = QtGui.QAction(self.parent)
|
|
181
|
+
self.action_show_histogram.setText("Show Histogram")
|
|
182
|
+
context_menu['Raster'].addAction(self.action_show_histogram)
|
|
183
|
+
self.action_show_histogram.triggered.connect(self.show_histogram)
|
|
184
|
+
|
|
185
|
+
self.action_show_2d_corr_coef = QtGui.QAction(self.parent)
|
|
186
|
+
self.action_show_2d_corr_coef.setText(
|
|
187
|
+
"Show 2D Correlation Coefficients")
|
|
188
|
+
context_menu['Raster'].addAction(self.action_show_2d_corr_coef)
|
|
189
|
+
self.action_show_2d_corr_coef.triggered.connect(self.show_ccoef)
|
|
190
|
+
|
|
191
|
+
self.action_export_data = QtGui.QAction(self.parent)
|
|
192
|
+
self.action_export_data.setText("Export Data")
|
|
193
|
+
context_menu['Raster'].addAction(self.action_export_data)
|
|
194
|
+
self.action_export_data.triggered.connect(self.export_data)
|
|
195
|
+
|
|
196
|
+
def metadata(self):
|
|
197
|
+
""" Basic Statistics """
|
|
198
|
+
self.parent.launch_context_item(dataprep.Metadata)
|
|
199
|
+
|
|
200
|
+
def basic_stats(self):
|
|
201
|
+
""" Basic Statistics """
|
|
202
|
+
self.parent.launch_context_item(show_table.BasicStats)
|
|
203
|
+
|
|
204
|
+
def equation_editor(self):
|
|
205
|
+
""" Equation Editor """
|
|
206
|
+
fnc = equation_editor.EquationEditor(self.parent)
|
|
207
|
+
self.parent.item_insert("Step", "Equation\n Editor", fnc)
|
|
208
|
+
|
|
209
|
+
def export_data(self):
|
|
210
|
+
""" Export raster data """
|
|
211
|
+
self.parent.launch_context_item(iodefs.ExportData)
|
|
212
|
+
|
|
213
|
+
def cut_data(self):
|
|
214
|
+
""" Export raster data """
|
|
215
|
+
fnc = dataprep.DataCut(self.parent)
|
|
216
|
+
self.parent.item_insert("Step", "Cut\nData", fnc)
|
|
217
|
+
|
|
218
|
+
def get_prof(self):
|
|
219
|
+
""" Export raster data """
|
|
220
|
+
fnc = dataprep.GetProf(self.parent)
|
|
221
|
+
self.parent.item_insert("Step", "Get\nProfile", fnc)
|
|
222
|
+
|
|
223
|
+
def gradients(self):
|
|
224
|
+
""" Compute different gradients """
|
|
225
|
+
fnc = cooper.Gradients(self.parent)
|
|
226
|
+
self.parent.item_insert("Step", "Gradients", fnc)
|
|
227
|
+
|
|
228
|
+
def norm_data(self):
|
|
229
|
+
""" Normalisation of data"""
|
|
230
|
+
fnc = normalisation.Normalisation(self.parent)
|
|
231
|
+
self.parent.item_insert("Step", "Normalisation", fnc)
|
|
232
|
+
|
|
233
|
+
def raster_interp(self):
|
|
234
|
+
""" Show raster data """
|
|
235
|
+
fnc = ginterp.PlotInterp(self.parent)
|
|
236
|
+
self.parent.item_insert("Step", "Raster Data \nInterpretation", fnc)
|
|
237
|
+
|
|
238
|
+
def depth_susc(self):
|
|
239
|
+
""" Depth and Susceptibility calculations """
|
|
240
|
+
fnc = tiltdepth.TiltDepth(self.parent)
|
|
241
|
+
self.parent.item_insert("Step",
|
|
242
|
+
"Tilt\nDepth\nInterpretation", fnc)
|
|
243
|
+
|
|
244
|
+
def rtp(self):
|
|
245
|
+
""" Compute rtp """
|
|
246
|
+
fnc = dataprep.RTP(self.parent)
|
|
247
|
+
self.parent.item_insert("Step", "RTP\nAngle", fnc)
|
|
248
|
+
|
|
249
|
+
def show_ccoef(self):
|
|
250
|
+
""" Show 2D correlation coefficients"""
|
|
251
|
+
self.parent.launch_context_item(graphs.PlotCCoef)
|
|
252
|
+
|
|
253
|
+
def show_histogram(self):
|
|
254
|
+
""" Show raster data """
|
|
255
|
+
self.parent.launch_context_item(graphs.PlotHist)
|
|
256
|
+
|
|
257
|
+
def show_raster_data(self):
|
|
258
|
+
""" Show raster data """
|
|
259
|
+
self.parent.launch_context_item(graphs.PlotRaster)
|
|
260
|
+
|
|
261
|
+
def show_surface(self):
|
|
262
|
+
""" Show surface """
|
|
263
|
+
self.parent.launch_context_item(graphs.PlotSurface)
|
|
264
|
+
|
|
265
|
+
def show_scatter_plot(self):
|
|
266
|
+
""" Show raster data """
|
|
267
|
+
self.parent.launch_context_item(graphs.PlotScatter)
|
|
268
|
+
|
|
269
|
+
def smoothing(self):
|
|
270
|
+
""" Smoothing of Data"""
|
|
271
|
+
fnc = smooth.Smooth(self.parent)
|
|
272
|
+
self.parent.item_insert("Step", "Smoothing", fnc)
|
|
273
|
+
|
|
274
|
+
def tilt(self):
|
|
275
|
+
""" Compute visibility """
|
|
276
|
+
fnc = cooper.Tilt1(self.parent)
|
|
277
|
+
self.parent.item_insert("Step", "Tilt\nAngle", fnc)
|
|
278
|
+
|
|
279
|
+
def visibility(self):
|
|
280
|
+
""" Compute visibility """
|
|
281
|
+
fnc = cooper.Visibility2d(self.parent)
|
|
282
|
+
self.parent.item_insert("Step", "Visibility", fnc)
|
|
283
|
+
|
|
284
|
+
def reproj(self):
|
|
285
|
+
""" Reproject a dataset """
|
|
286
|
+
fnc = dataprep.DataReproj(self.parent)
|
|
287
|
+
self.parent.item_insert("Step", "Data\nReprojection", fnc)
|
|
288
|
+
|
|
289
|
+
def merge(self):
|
|
290
|
+
""" Merge datasets """
|
|
291
|
+
fnc = dataprep.DataMerge(self.parent)
|
|
292
|
+
self.parent.item_insert("Step", "Data\nMerge", fnc)
|
|
293
|
+
|
|
294
|
+
def grid(self):
|
|
295
|
+
""" Grid datasets """
|
|
296
|
+
fnc = dataprep.DataGrid(self.parent)
|
|
297
|
+
self.parent.item_insert("Step", "Grid\nPoint Data", fnc)
|
|
298
|
+
|
|
299
|
+
def igrf(self):
|
|
300
|
+
""" Grid datasets """
|
|
301
|
+
fnc = igrf.IGRF(self.parent)
|
|
302
|
+
self.parent.item_insert("Step", "Remove\nIGRF", fnc)
|
|
303
|
+
|
|
304
|
+
def import_data(self):
|
|
305
|
+
""" Imports data"""
|
|
306
|
+
fnc = iodefs.ImportData(self.parent)
|
|
307
|
+
self.parent.item_insert("Io", "Import Data", fnc)
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: normalisation.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
|
+
""" Normalisation function """
|
|
26
|
+
|
|
27
|
+
from PyQt4 import QtGui, QtCore
|
|
28
|
+
import numpy as np
|
|
29
|
+
import scipy.stats as sstat
|
|
30
|
+
import copy
|
|
31
|
+
import warnings
|
|
32
|
+
import pygmi.menu_default as menu_default
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
warnings.simplefilter('always', RuntimeWarning)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Normalisation(QtGui.QDialog):
|
|
39
|
+
""" Class Normalisation """
|
|
40
|
+
def __init__(self, parent):
|
|
41
|
+
QtGui.QDialog.__init__(self, parent)
|
|
42
|
+
|
|
43
|
+
self.indata = {}
|
|
44
|
+
self.outdata = {}
|
|
45
|
+
self.parent = parent
|
|
46
|
+
self.pbar = parent.pbar
|
|
47
|
+
self.reportback = self.parent.showprocesslog
|
|
48
|
+
|
|
49
|
+
self.radiobutton_interval = QtGui.QRadioButton()
|
|
50
|
+
self.radiobutton_mean = QtGui.QRadioButton()
|
|
51
|
+
self.radiobutton_median = QtGui.QRadioButton()
|
|
52
|
+
self.radiobutton_8bit = QtGui.QRadioButton()
|
|
53
|
+
|
|
54
|
+
self.setupui()
|
|
55
|
+
|
|
56
|
+
self.name = "Normalisation"
|
|
57
|
+
self.normtype = 'minmax' # mimax/meanstd/medmad/histeq
|
|
58
|
+
|
|
59
|
+
def setupui(self):
|
|
60
|
+
""" Setup UI """
|
|
61
|
+
|
|
62
|
+
verticallayout = QtGui.QVBoxLayout(self)
|
|
63
|
+
horizontallayout = QtGui.QHBoxLayout()
|
|
64
|
+
buttonbox = QtGui.QDialogButtonBox()
|
|
65
|
+
helpdocs = menu_default.HelpButton('pygmi.raster.normalisation')
|
|
66
|
+
|
|
67
|
+
self.radiobutton_interval.setChecked(True)
|
|
68
|
+
|
|
69
|
+
groupbox = QtGui.QGroupBox()
|
|
70
|
+
verticallayout_2 = QtGui.QVBoxLayout(groupbox)
|
|
71
|
+
|
|
72
|
+
buttonbox.setOrientation(QtCore.Qt.Horizontal)
|
|
73
|
+
buttonbox.setStandardButtons(buttonbox.Cancel | buttonbox.Ok)
|
|
74
|
+
|
|
75
|
+
verticallayout_2.addWidget(self.radiobutton_interval)
|
|
76
|
+
verticallayout_2.addWidget(self.radiobutton_mean)
|
|
77
|
+
verticallayout_2.addWidget(self.radiobutton_median)
|
|
78
|
+
verticallayout_2.addWidget(self.radiobutton_8bit)
|
|
79
|
+
|
|
80
|
+
horizontallayout.addWidget(helpdocs)
|
|
81
|
+
horizontallayout.addWidget(buttonbox)
|
|
82
|
+
|
|
83
|
+
verticallayout.addWidget(groupbox)
|
|
84
|
+
verticallayout.addLayout(horizontallayout)
|
|
85
|
+
|
|
86
|
+
self.setWindowTitle("Normalisation")
|
|
87
|
+
groupbox.setTitle("Normalisation/Scaling")
|
|
88
|
+
self.radiobutton_interval.setText("Interval [0 1]")
|
|
89
|
+
self.radiobutton_mean.setText("Mean: zero, Standard deviation: unity")
|
|
90
|
+
self.radiobutton_8bit.setText("8-bit histogram equalisation [0 255]")
|
|
91
|
+
self.radiobutton_median.setText(
|
|
92
|
+
"Median: zero, Median absolute deviation: unity")
|
|
93
|
+
|
|
94
|
+
buttonbox.accepted.connect(self.accept)
|
|
95
|
+
buttonbox.rejected.connect(self.reject)
|
|
96
|
+
|
|
97
|
+
def settings(self):
|
|
98
|
+
""" Settings """
|
|
99
|
+
temp = self.exec_()
|
|
100
|
+
if temp == 0:
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
data = copy.deepcopy(self.indata['Raster'])
|
|
104
|
+
# if datachecks.Datachecks(self).isdata(data) is False:
|
|
105
|
+
# return data
|
|
106
|
+
transform = np.zeros((2, 2))
|
|
107
|
+
if self.radiobutton_interval.isChecked():
|
|
108
|
+
for i in data:
|
|
109
|
+
tmp1 = i.data.min()
|
|
110
|
+
tmp2 = i.data.max() - i.data.min()
|
|
111
|
+
tmp3 = 'minmax'
|
|
112
|
+
norm_type = 'Normalised to interval [0 1]'
|
|
113
|
+
i, transform = self.datacommon(i, tmp1, tmp2, tmp3, norm_type)
|
|
114
|
+
elif self.radiobutton_mean.isChecked():
|
|
115
|
+
for i in data:
|
|
116
|
+
tmp1 = i.data.mean()
|
|
117
|
+
tmp2 = i.data.std()
|
|
118
|
+
tmp3 = 'meanstd'
|
|
119
|
+
norm_type = 'Normalised to mean, standard deviation = 1'
|
|
120
|
+
i, transform = self.datacommon(i, tmp1, tmp2, tmp3, norm_type)
|
|
121
|
+
elif self.radiobutton_median.isChecked():
|
|
122
|
+
for i in data:
|
|
123
|
+
tmp1 = np.median(i.data.compressed())
|
|
124
|
+
tmp2 = np.median(abs(i.data.compressed() - tmp1))
|
|
125
|
+
tmp3 = 'medmad'
|
|
126
|
+
norm_type = 'Normalised to median, mean absolute deviation = 1'
|
|
127
|
+
i, transform = self.datacommon(i, tmp1, tmp2, tmp3, norm_type)
|
|
128
|
+
elif self.radiobutton_8bit.isChecked():
|
|
129
|
+
for i in data:
|
|
130
|
+
norm_type = 'Normalised-histogram equalisation'
|
|
131
|
+
if True:
|
|
132
|
+
# if (i.proc.__contains__(norm_type)) is False:
|
|
133
|
+
nlevels = 256
|
|
134
|
+
no_pix = i.data.count()
|
|
135
|
+
dummy_dat = np.sort(i.data[np.isnan(i.data) != 1],
|
|
136
|
+
axis=None)
|
|
137
|
+
|
|
138
|
+
# ndat_eq = np.array(data[i].data, copy=True)
|
|
139
|
+
# ndat_eq = np.nan
|
|
140
|
+
ndat_eq = np.array(i.data, copy=True) * np.nan
|
|
141
|
+
transform = np.zeros((nlevels, 2))
|
|
142
|
+
# prog = wx.ProgressDialog('Histogram equalisation', \
|
|
143
|
+
# 'Normalisation', nlevels, None, wx.PD_SMOOTH)
|
|
144
|
+
tmp = i.data.flatten('F')
|
|
145
|
+
tmpndat = ndat_eq.flatten('F')
|
|
146
|
+
for j in range(nlevels):
|
|
147
|
+
cop = np.round(float(j+1)*(no_pix/nlevels))
|
|
148
|
+
cutoff = dummy_dat[cop-1]
|
|
149
|
+
idx = np.nonzero(tmp < cutoff)
|
|
150
|
+
transform[j, 0:2] = [j+1, sstat.nanmedian(tmp[idx])]
|
|
151
|
+
tmp[idx] = np.nan
|
|
152
|
+
tmpndat[idx] = j+1
|
|
153
|
+
# prog.Update(j)
|
|
154
|
+
# prog.Destroy()
|
|
155
|
+
ndat_eq = np.reshape(tmpndat, i.data.shape, 'F')
|
|
156
|
+
tmpd = np.ma.array(ndat_eq)
|
|
157
|
+
i.data = tmpd.astype('float32')
|
|
158
|
+
i.data = np.ma.masked_invalid(i.data)
|
|
159
|
+
# i.proc.append(norm_type)
|
|
160
|
+
n_norms = len(i.norm)
|
|
161
|
+
i.norm[n_norms] = {'type': 'histeq',
|
|
162
|
+
'transform': transform}
|
|
163
|
+
|
|
164
|
+
self.outdata['Raster'] = data
|
|
165
|
+
self.pbar.to_max()
|
|
166
|
+
return True
|
|
167
|
+
|
|
168
|
+
def datacommon(self, data, tmp1, tmp2, tmp3, tmp4):
|
|
169
|
+
""" Common stuff used in the process routine """
|
|
170
|
+
transform = np.zeros((2, 2))
|
|
171
|
+
if tmp1 != 0.0 or tmp2 != 1.0:
|
|
172
|
+
transform[0:2, 0] = [0, 1]
|
|
173
|
+
transform[0:2, 1] = [tmp1, tmp2]
|
|
174
|
+
|
|
175
|
+
dtmp = data.data.data
|
|
176
|
+
mtmp = data.data.mask
|
|
177
|
+
dtmp -= tmp1
|
|
178
|
+
dtmp /= tmp2
|
|
179
|
+
|
|
180
|
+
data.data = np.ma.array(dtmp, mask=mtmp)
|
|
181
|
+
# data.data -= tmp1
|
|
182
|
+
# data.data /= tmp2
|
|
183
|
+
# data.data[np.isnan(data.data)] = data.nullvalue
|
|
184
|
+
n_norms = len(data.norm)
|
|
185
|
+
# data.proc.append(tmp4)
|
|
186
|
+
data.norm[n_norms] = {'type': tmp3, 'transform': transform}
|
|
187
|
+
return data, transform
|