-
Notifications
You must be signed in to change notification settings - Fork 10
/
runGsolve.py
1779 lines (1576 loc) · 86.1 KB
/
runGsolve.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
Created on Tue May 13 17:47:48 2014
@author: jackm and GOB
"""
from __future__ import with_statement
from distutils.core import setup
import sys
from PyQt4 import QtCore
from PyQt4 import QtGui
from Tkinter import Tk
from tkFileDialog import askopenfilename
import xlrd
import xlwt
import os.path
import numpy as np
from xlutils.copy import copy
import ctypes
import GsolveGUIv3
import matplotlib
import matplotlib.pyplot
import gdal
gdal.UseExceptions()
import time
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as NavigationToolbar
class DesignerMainWindow(QtGui.QMainWindow, GsolveGUIv3.Ui_Gsolve):
def __init__(self, parent=None):
splash_pix = QtGui.QPixmap(r'images\\Gsolvelog.png')
splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
time.sleep(2)
splash.close()
super(DesignerMainWindow, self).__init__(parent)
self.setupUi(self)
self.showMaximized()
#FullScreen()
self.connectActions()
self.setWindowIcon(QtGui.QIcon("images\\gsolve.png"))
# Initialise Calibration Table Data with data base
AllwbCal = xlrd.open_workbook(os.path.join('Calibration Tables/G meter Calibration Table.xls'))
CalibrationTableName = AllwbCal.sheet_names()
NCaltabs = np.size(CalibrationTableName)
for i in range(0, NCaltabs):
self.CalibrationTabSelectview.addItem(str(CalibrationTableName[i]))
self.CalTabSelect.addItem(str(CalibrationTableName[i]))
CalTab = AllwbCal.sheet_by_index(0)
N = CalTab.nrows
self.CalibrationTabView.setRowCount(N)
self.CalibrationTabView.setColumnCount(3)
for i in range(0,N):
self.CalibrationTabView.setItem(i, 0,
QtGui.QTableWidgetItem(str(CalTab.cell(i,0).value)))
self.CalibrationTabView.setItem(i, 1,
QtGui.QTableWidgetItem(str(CalTab.cell(i,1).value)))
self.CalibrationTabView.setItem(i, 2,
QtGui.QTableWidgetItem(str(CalTab.cell(i,2).value)))
# Initialise Absolute Gravity Stations with data base
ABSGw = xlrd.open_workbook(os.path.join('Absolute Gravity/Absolute Gravity.xls'))
AbsGDATA = ABSGw.sheet_by_name('Sheet1')
N2 = AbsGDATA.nrows
self.AbsGTabview.setRowCount(N2)
for i in range(0, N2):
self.AbsGTabview.setItem(i, 0,
QtGui.QTableWidgetItem(str(AbsGDATA.cell(i,0).value)))
self.AbsGTabview.setItem(i, 1,
QtGui.QTableWidgetItem(str(AbsGDATA.cell(i,1).value)))
self.AbsGTabview.setItem(i, 2,
QtGui.QTableWidgetItem(str(AbsGDATA.cell(i,2).value)))
self.AbsGTabview.setItem(i, 3,
QtGui.QTableWidgetItem(str(AbsGDATA.cell(i,3).value)))
def main(self):
self.show()
def connectActions(self):
self.ImportsureveyData.clicked.connect(self.Import_survey_file)
self.ImportNewCalTab.clicked.connect(self.Import_Cal_Tab)
self.CalibrationTabSelectview.currentIndexChanged.connect(self.View_Cal_Tab)
self.RemoveCalTab.clicked.connect(self.Remove_Cal_Tab)
self.AddNewAbsTie.clicked.connect(self.AddNewAbsTieForSolve)
self.CalculateBeta.stateChanged.connect(self.USE_BETA)
self.ImportNewAbsG.clicked.connect(self.Import_AbsG_data)
self.RemoveAbsG.clicked.connect(self.Remove_AbsG_data)
self.SolveAll.clicked.connect(self.SolveIT)
self.UpdateEll.clicked.connect(self.SolveIT)
self.AddNewSurveyMeasurement.clicked.connect(self.AddMeasurement)
self.AddNewAbsG.clicked.connect(self.AddNewAbsGTie)
self.SaveNewAbsG.clicked.connect(self.SaveAllAbsGTie)
self.RemoveAbsTie.clicked.connect(self.RemoveAbsTieForSurvey)
self.ExportResults.clicked.connect(self.ExportMainResults)
self.ExportDetailedResults.clicked.connect(self.ExportDetailedResultstoEx)
self.ExportGravityreductions.clicked.connect(self.ExportDetailedResultstoEx)
self.RemoveSurveyMeasurement.clicked.connect(self.RemoveSurveyMeasurementsDO)
self.CDFplot.clicked.connect(self.CDFplots)
self.driftplot_2.clicked.connect(self.Driftplot)
self.actionExit.triggered.connect(self.Exitsurvey)
self.actionNew.triggered.connect(self.Newsurvey)
self.actionAbout.triggered.connect(self.AboutGsolve)
self.SaveSurveyData.clicked.connect(self.SaveSurveyDatatoEx)
self.ImportDEM.clicked.connect(self.ImportDEMdo)
self.ImportdatapointsTC.clicked.connect(self.ImportdatapointsTCdo)
self.CalcTC.clicked.connect(self.CalcTCdo)
self.ExportTCresults.clicked.connect(self.ExportTCdo)
def SaveSurveyDatatoEx(self):
import tkFileDialog
Tk().withdraw()
filename = tkFileDialog.asksaveasfilename()
w = xlwt.Workbook()
Nrows = self.SurveyDataTab.rowCount()
Outpage = w.add_sheet('Survey Data', cell_overwrite_ok=True)
Outpage2 = w.add_sheet('Locations', cell_overwrite_ok=True)
w.get_sheet(0).write(0,0,str('Station Name'))
w.get_sheet(0).write(0,1,str('Day'))
w.get_sheet(0).write(0,2,str('Month'))
w.get_sheet(0).write(0,3,str('Year'))
w.get_sheet(0).write(0,4,str('Hour'))
w.get_sheet(0).write(0,5,str('Minute'))
w.get_sheet(0).write(0,6,str('Dial Gravity'))
w.get_sheet(0).write(0,7,str('Loop Number'))
w.get_sheet(1).write(0,0,str('Station Name'))
w.get_sheet(1).write(0,1,str('Latitude'))
w.get_sheet(1).write(0,2,str('Longitude'))
w.get_sheet(1).write(0,3,str('Elevation'))
SurveyedNames = strs = ["" for x in range(Nrows)]
for i in range(0,Nrows):
Name = self.SurveyDataTab.item(i,0)
Day = self.SurveyDataTab.item(i,5)
Month = self.SurveyDataTab.item(i,6)
Year = self.SurveyDataTab.item(i,7)
Hour = self.SurveyDataTab.item(i,8)
Minute = self.SurveyDataTab.item(i,9)
Dial = self.SurveyDataTab.item(i,4)
Loop = self.SurveyDataTab.item(i,10)
w.get_sheet(0).write(int(i+1),0,str(QtGui.QTableWidgetItem.text(Name)))
w.get_sheet(0).write(int(i+1),1,float(str(QtGui.QTableWidgetItem.text(Day))))
w.get_sheet(0).write(int(i+1),2,float(str(QtGui.QTableWidgetItem.text(Month))))
w.get_sheet(0).write(int(i+1),3,float(str(QtGui.QTableWidgetItem.text(Year))))
w.get_sheet(0).write(int(i+1),4,float(str(QtGui.QTableWidgetItem.text(Hour))))
w.get_sheet(0).write(int(i+1),5,float(str(QtGui.QTableWidgetItem.text(Minute))))
w.get_sheet(0).write(int(i+1),6,float(str(QtGui.QTableWidgetItem.text(Dial))))
w.get_sheet(0).write(int(i+1),7,float(str(QtGui.QTableWidgetItem.text(Loop))))
SurveyedNames[i] = str(QtGui.QTableWidgetItem.text(Name))
SiteNames = np.unique(SurveyedNames)
Nlocs = np.max(np.shape(SiteNames))
print(Nlocs)
for i in range(0,Nlocs):
for j in range(0,Nrows):
Namesj = self.SurveyDataTab.item(j,0)
Namej = str(QtGui.QTableWidgetItem.text(Namesj))
Latsj = self.SurveyDataTab.item(j,1)
Latj = float(str(QtGui.QTableWidgetItem.text(Latsj)))
Longsj = self.SurveyDataTab.item(j,2)
Longj = float(str(QtGui.QTableWidgetItem.text(Longsj)))
Elevsj = self.SurveyDataTab.item(j,3)
Elevj = float(str(QtGui.QTableWidgetItem.text(Elevsj)))
if Namej == SiteNames[i]:
w.get_sheet(1).write(int(i+1),0,Namej)
w.get_sheet(1).write(int(i+1),1,Latj)
w.get_sheet(1).write(int(i+1),2,Longj)
w.get_sheet(1).write(int(i+1),3,Elevj)
w.save(filename+'.xls')
def AboutGsolve(self):
sw = ctypes.windll.user32.MessageBoxA(0,'Gsolve, python version 1.'+ \
'\n'+'\n'+'Created by Jack McCubbine and Grant O\'Brien,'+'\n'+ \
'May 2014-2016.',\
'About', 0)
print sw
def Newsurvey(self):
sw = ctypes.windll.user32.MessageBoxA(0, 'Are you sure you want to \
start a new survey? This will clear all current survey data and \
results.', 'New', 1)
if sw == 1:
#raise SystemExit
self.DetailedResultsTabview.setRowCount(0)
self.MainResultsTabview.setRowCount(0)
self.DriftTabview.setRowCount(0)
self.SurveyDataTab.setRowCount(0)
self.SurveyTies.setRowCount(0)
self.GravityReductionsTab.setRowCount(0)
def Exitsurvey(self):
sw = ctypes.windll.user32.MessageBoxA(0, 'Are you sure you want to \
exit?', 'Exit', 1)
if sw == 1:
#raise SystemExit
print "Goodbye"
os._exit(1)
###############################################################################
def Driftplot(self):
self.BL = []
self.TIM = []
global BL #this imports the base lines and
global TIM # and time in minutes
Loopp = self.LoopSel_2.currentText()
Nrows = self.DetailedResultsTabview.rowCount()
if Loopp == 'All':
BLp = BL
CDialp = np.zeros((int(Nrows), 1))
TIDEp = np.zeros((int(Nrows), 1))
TIMp = np.zeros((int(Nrows), 1))
LoopNamesp = strs = ["" for x in range(int(Nrows))]
k2=-1
for i in range(0, int(Nrows)):
k2 = k2+1
CDial = self.DetailedResultsTabview.item(i, 5)
TIDE = self.DetailedResultsTabview.item(i, 11)
LoopNames = self.DetailedResultsTabview.item(i, 0)
LoopNamesp[k2] = str(QtGui.QTableWidgetItem.text(LoopNames))
CDialp[k2] = float(QtGui.QTableWidgetItem.text(CDial))
TIDEp[k2] = float(QtGui.QTableWidgetItem.text(TIDE))
TIMp[k2] = TIM[i]
NrowsAll = self.MainResultsTabview.rowCount()
GRAV = np.zeros((Nrows, 1))
for i in range(0, Nrows):
for j in range(0, int(NrowsAll)):
NameAllj = self.MainResultsTabview.item(j, 0)
Grav = self.MainResultsTabview.item(j, 1)
NameAlljreal = str(QtGui.QTableWidgetItem.text(NameAllj))
GravAlljreal = float(QtGui.QTableWidgetItem.text(Grav))
if NameAlljreal == LoopNamesp[i]:
GRAV[i] = GravAlljreal
Drift = self.DriftTabview.item(0, 1)
Driftp = -float(QtGui.QTableWidgetItem.text(Drift))
Betat = self.BetaOut
Beta = -float(QtGui.QLineEdit.text(Betat))
Betatin = self.BetaIne
Betain = -float(QtGui.QLineEdit.text(Betatin))
x = self.CalculateBeta
# if Betain==Beta and QtGui.QCheckBox.isChecked(x)==False:
# CDialp=CDialp-Beta*CDialp
# Beta=0
fig = matplotlib.pyplot.figure()
ax = fig.add_subplot(111)
x = TIMp/60
y = GRAV-BLp-CDialp-Beta*CDialp+TIDEp+Driftp*TIMp[0]/60
y2 = -Driftp*TIMp/60+Driftp*TIMp[0]/60
ax.plot(x, y,'x')
ax.plot(x, y2)
title = 'Plot of the drift function and residuals for loop '+ \
str(Loopp)
matplotlib.pyplot.xlabel('Time in hours since start of loop')
matplotlib.pyplot.ylabel('mGal')
ax.set_title(title)
matplotlib.pyplot.show()
if Loopp != 'All':
BLp = BL[int(Loopp)-1]
k = 0
for i in range(0, int(Nrows)):
Loopqt = self.DetailedResultsTabview.item(i, 12)
Loop = str(QtGui.QTableWidgetItem.text(Loopqt))
if Loop == Loopp:
k = k+1
CDialp = np.zeros((k, 1))
TIDEp = np.zeros((k, 1))
TIMp = np.zeros((k, 1))
LoopNamesp = strs = ["" for x in range(k)]
k2 = -1
for i in range(0, int(Nrows)):
Loopqt = self.DetailedResultsTabview.item(i, 12)
Loop = str(QtGui.QTableWidgetItem.text(Loopqt))
if Loop == Loopp:
k2 = k2+1
CDial = self.DetailedResultsTabview.item(i, 5)
TIDE = self.DetailedResultsTabview.item(i, 11)
LoopNames = self.DetailedResultsTabview.item(i, 0)
LoopNamesp[k2] = str(QtGui.QTableWidgetItem.text(LoopNames))
CDialp[k2] = float(QtGui.QTableWidgetItem.text(CDial))
TIDEp[k2] = float(QtGui.QTableWidgetItem.text(TIDE))
TIMp[k2] = TIM[i]
NrowsAll = self.MainResultsTabview.rowCount()
GRAV = np.zeros((k, 1))
for i in range(0, len(LoopNamesp)):
for j in range(0, int(NrowsAll)):
NameAllj = self.MainResultsTabview.item(j, 0)
Grav = self.MainResultsTabview.item(j, 1)
NameAlljreal = str(QtGui.QTableWidgetItem.text(NameAllj))
GravAlljreal = float(QtGui.QTableWidgetItem.text(Grav))
if NameAlljreal == LoopNamesp[i]:
GRAV[i] = GravAlljreal
Drift = self.DriftTabview.item(int(Loopp)-1, 1)
Driftp = -float(QtGui.QTableWidgetItem.text(Drift))
Betat = self.BetaOut
Beta = -float(QtGui.QLineEdit.text(Betat))
Betatin = self.BetaIne
Betain = -float(QtGui.QLineEdit.text(Betatin))
x = self.CalculateBeta
#if Betain==Beta and QtGui.QCheckBox.isChecked(x)==False:
#CDialp=CDialp-Beta*CDialp
#Beta=0
CIt = self.ConfInt
CI = float(QtGui.QLineEdit.text(CIt))
fig = matplotlib.pyplot.figure()
ax = fig.add_subplot(111)
x = TIMp/60
y = GRAV-BLp-CDialp-Beta*CDialp+TIDEp+Driftp*TIMp[0]/60
y2 = -Driftp*TIMp/60+Driftp*TIMp[0]/60
ax.plot(x, y,'x')
ax.plot(x, y2)
title = 'Plot of the drift function and residuals for loop ' \
+str(Loopp)
matplotlib.pyplot.xlabel('Time in hours since start of loop')
matplotlib.pyplot.ylabel('mGal')
ax.set_title(title)
matplotlib.pyplot.show()
###############################################################################
def CDFplots(self):
Loopp = self.LoopCDFSel.currentText()
Nrows = self.DetailedResultsTabview.rowCount()
if Loopp == 'All':
RESp = np.zeros((Nrows, 1))
for i in range(0,int(Nrows)):
Residual = self.DetailedResultsTabview.item(i, 13)
RESp[i] = float(QtGui.QTableWidgetItem.text(Residual))
fig = matplotlib.pyplot.figure()
ax = fig.add_subplot(111)
x = np.sort(RESp, axis=0)
y=np.linspace(0, 1, np.size(x))
ax.plot(x, y)
ax.set_title('CDF plot for all loops, mean:' \
+str(np.round(100*np.mean(RESp))/100)+ \
', standard deviation:'+str(np.round(100*np.std(RESp))/100))
matplotlib.pyplot.show()
if Loopp != 'All':
k = 0
for i in range(0, int(Nrows)):
Loopqt = self.DetailedResultsTabview.item(i, 12)
Loop = str(QtGui.QTableWidgetItem.text(Loopqt))
if Loop == Loopp:
k = k+1
RESp = np.zeros((k, 1))
k2 = -1
for i in range(0, int(Nrows)):
Loopqt = self.DetailedResultsTabview.item(i, 12)
Loop = str(QtGui.QTableWidgetItem.text(Loopqt))
if Loop == Loopp:
k2 = k2+1
Residual = self.DetailedResultsTabview.item(i, 13)
RESp[k2] = float(QtGui.QTableWidgetItem.text(Residual))
fig = matplotlib.pyplot.figure()
ax = fig.add_subplot(111)
x = np.sort(RESp, axis=0)
y=np.linspace(0, 1, np.size(x))
ax.plot(x, y)
title='CDF plot for loop '+str(Loopp)
ax.set_title(title+', mean: ' \
+str(np.round(100*np.mean(RESp))/100)+ \
', standard deviation: '+str(np.round(100*np.std(RESp))/100))
matplotlib.pyplot.show()
def RemoveSurveyMeasurementsDO(self):
Nrows = self.SurveyDataTab.rowCount()
k = 0;
SurveyedNames = strs = ["" for x in range(Nrows)]
Lats = np.zeros((Nrows, 1))
Longs = np.zeros((Nrows, 1))
Elevs = np.zeros((Nrows, 1))
Days = np.zeros((Nrows, 1))
Days = np.zeros((Nrows, 1))
Months = np.zeros((Nrows, 1))
Years = np.zeros((Nrows, 1))
Hours = np.zeros((Nrows, 1))
Minutes = np.zeros((Nrows, 1))
DialReadings = np.zeros((Nrows, 1))
Loops = np.zeros((Nrows, 1))
for i in range(0, Nrows):
SurveyedName = self.SurveyDataTab.item(i, 0)
Lat = self.SurveyDataTab.item(i, 1)
Long = self.SurveyDataTab.item(i, 2)
Elev = self.SurveyDataTab.item(i, 3)
DialReading = self.SurveyDataTab.item(i, 4)
Day = self.SurveyDataTab.item(i, 5)
Month = self.SurveyDataTab.item(i, 6)
Year = self.SurveyDataTab.item(i, 7)
Hour = self.SurveyDataTab.item(i, 8)
Minute = self.SurveyDataTab.item(i, 9)
Loop = self.SurveyDataTab.item(i, 10)
SurveyedNames[i] = QtGui.QTableWidgetItem.text(SurveyedName)
Lats[i] = float(QtGui.QTableWidgetItem.text(Lat))
Longs[i] = float(QtGui.QTableWidgetItem.text(Long))
Elevs[i] = float(QtGui.QTableWidgetItem.text(Elev))
DialReadings[i] = float(QtGui.QTableWidgetItem.text(DialReading))
Days[i] = float(QtGui.QTableWidgetItem.text(Day))
Months[i] = float(QtGui.QTableWidgetItem.text(Month))
Years[i] = float(QtGui.QTableWidgetItem.text(Year))
Hours[i] = float(QtGui.QTableWidgetItem.text(Hour))
Minutes[i] = float(QtGui.QTableWidgetItem.text(Minute))
Loops[i] = float(QtGui.QTableWidgetItem.text(Loop))
if self.SurveyDataTab.isItemSelected(SurveyedName) == False:
k = k+1
self.SurveyDataTab.setRowCount(k)
k1 = -1
for i in range(0, int(Nrows)):
x = self.SurveyDataTab.item(i, 0)
if self.SurveyDataTab.isItemSelected(x) == False:
k1 = k1+1
self.SurveyDataTab.setItem(int(k1),0,
QtGui.QTableWidgetItem(str(SurveyedNames[i])))
self.SurveyDataTab.setItem(int(k1),1,
QtGui.QTableWidgetItem(str(float(Lats[i]))))
self.SurveyDataTab.setItem(int(k1),2,
QtGui.QTableWidgetItem(str(float(Longs[i]))))
self.SurveyDataTab.setItem(int(k1),3,
QtGui.QTableWidgetItem(str(float(Elevs[i]))))
self.SurveyDataTab.setItem(int(k1),4,
QtGui.QTableWidgetItem(str(float(DialReadings[i]))))
self.SurveyDataTab.setItem(int(k1),5,
QtGui.QTableWidgetItem(str(float(Days[i]))))
self.SurveyDataTab.setItem(int(k1),6,
QtGui.QTableWidgetItem(str(float(Months[i]))))
self.SurveyDataTab.setItem(int(k1),7,
QtGui.QTableWidgetItem(str(float(Years[i]))))
self.SurveyDataTab.setItem(int(k1),8,
QtGui.QTableWidgetItem(str(float(Hours[i]))))
self.SurveyDataTab.setItem(int(k1),9,
QtGui.QTableWidgetItem(str(float(Minutes[i]))))
self.SurveyDataTab.setItem(int(k1),10,
QtGui.QTableWidgetItem(str(float(Loops[i]))))
def ExportDetailedResultstoEx(self):
import tkFileDialog
Tk().withdraw()
filename = tkFileDialog.asksaveasfilename()
w = xlwt.Workbook()
Outpage = w.add_sheet('Survey Measurements',
cell_overwrite_ok=True)
Outpage = w.add_sheet('Gravity Results and reductions',
cell_overwrite_ok=True)
Outpage = w.add_sheet('Gravimetre Drift',
cell_overwrite_ok=True)
Outpage = w.add_sheet('Beta Calibration Factor',
cell_overwrite_ok=True)
Outpage = w.add_sheet('Meta Data About Solution',
cell_overwrite_ok=True)
x = self.CalculateBeta
if QtGui.QCheckBox.isChecked(x) == True:
CB = 1
else:
CB = 0
x = self.UseLoops
if QtGui.QCheckBox.isChecked(x) == True:
UL = 1
else:
UL = 0
w.get_sheet(4).write(0, 0, str('Method Used:'))
Method = self.MethodSelect.currentText()
w.get_sheet(4).write(int(1), 0, str(Method))
w.get_sheet(4).write(2, 0,
str('Beta Calibration Factor Calculated Or Provided?:'))
if CB == 1:
w.get_sheet(4).write(int(3), 0, str("Calculated"))
if CB == 0:
w.get_sheet(4).write(int(3), 0, str("Provided"))
w.get_sheet(4).write(4, 0, str('Loops used?:'))
if UL == 1:
w.get_sheet(4).write(int(5), 0, str("Yes, "))
Nloops = self.DriftTabview.rowCount()
w.get_sheet(4).write(int(5), 1, str(str(Nloops)+ " Loops Used"))
if UL == 0:
w.get_sheet(4).write(int(5), 0, str("No"))
w.get_sheet(4).write(6, 0, str('Ellipsoid Used for reductions:'))
ELLname = self.Ellipsoidselect.currentText()
w.get_sheet(4).write(7, 0, str(ELLname))
w.get_sheet(3).write(0, 0, str('Beta Calibration factor'))
Betat = self.BetaOut
Beta = float(QtGui.QLineEdit.text(Betat))
w.get_sheet(3).write(int(1), 0, str(Beta))
Nrows=self.DriftTabview.rowCount()
w.get_sheet(2).write(0, 0, str('Loop ID'))
w.get_sheet(2).write(0, 1, str('Drift (mGal per hour)'))
for i in range(0, Nrows):
Name = self.DriftTabview.item(i, 0)
Drift = self.DriftTabview.item(i, 1)
# Weight=self.DetailedResultsTabview.item(i,13)
w.get_sheet(2).write(int(i+1), 0,
str(QtGui.QTableWidgetItem.text(Name)))
w.get_sheet(2).write(int(i+1), 1,
float(str(QtGui.QTableWidgetItem.text(Drift))))
Nrows = self.DetailedResultsTabview.rowCount()
w.get_sheet(0).write(0, 0, str('Name'))
w.get_sheet(0).write(0, 1, str('Latitude'))
w.get_sheet(0).write(0, 2, str('Longitude'))
w.get_sheet(0).write(0, 3, str('Elevation'))
w.get_sheet(0).write(0, 4, str('Dial'))
w.get_sheet(0).write(0, 5, str('Calibrated Dial'))
w.get_sheet(0).write(0, 6, str('Day'))
w.get_sheet(0).write(0, 7, str('Month'))
w.get_sheet(0).write(0, 8, str('Year'))
w.get_sheet(0).write(0, 9, str('Hour'))
w.get_sheet(0).write(0, 10, str('Minute'))
w.get_sheet(0).write(0, 11, str('Tidal Effect'))
w.get_sheet(0).write(0, 12, str('Loop'))
w.get_sheet(0).write(0, 13, str('Residual'))
# w.get_sheet(0).write(0,13,str('Weight'))
for i in range(0, Nrows):
Name = self.DetailedResultsTabview.item(i,0)
Latitude = self.DetailedResultsTabview.item(i,1)
Longitude = self.DetailedResultsTabview.item(i,2)
Elev = self.DetailedResultsTabview.item(i,3)
Dial = self.DetailedResultsTabview.item(i,4)
CalibratedDial = self.DetailedResultsTabview.item(i,5)
Day = self.DetailedResultsTabview.item(i,6)
Month = self.DetailedResultsTabview.item(i,7)
Year = self.DetailedResultsTabview.item(i,8)
Hour = self.DetailedResultsTabview.item(i,9)
Minute = self.DetailedResultsTabview.item(i,10)
Tidal = self.DetailedResultsTabview.item(i,11)
Loop = self.DetailedResultsTabview.item(i,12)
Residual = self.DetailedResultsTabview.item(i,13)
# Weight=self.DetailedResultsTabview.item(i,13)
w.get_sheet(0).write(int(i+1),0,
str(QtGui.QTableWidgetItem.text(Name)))
w.get_sheet(0).write(int(i+1),1,
float(str(QtGui.QTableWidgetItem.text(Latitude))))
w.get_sheet(0).write(int(i+1),2,
float(str(QtGui.QTableWidgetItem.text(Longitude))))
w.get_sheet(0).write(int(i+1),3,
float(str(QtGui.QTableWidgetItem.text(Elev))))
w.get_sheet(0).write(int(i+1),4,
float(str(QtGui.QTableWidgetItem.text(Dial))))
w.get_sheet(0).write(int(i+1),5,
float(str(QtGui.QTableWidgetItem.text(CalibratedDial))))
w.get_sheet(0).write(int(i+1),6,
float(str(QtGui.QTableWidgetItem.text(Day))))
w.get_sheet(0).write(int(i+1),7,
float(str(QtGui.QTableWidgetItem.text(Month))))
w.get_sheet(0).write(int(i+1),8,
float(str(QtGui.QTableWidgetItem.text(Year))))
w.get_sheet(0).write(int(i+1),9,
float(str(QtGui.QTableWidgetItem.text(Hour))))
w.get_sheet(0).write(int(i+1),10,
float(str(QtGui.QTableWidgetItem.text(Minute))))
w.get_sheet(0).write(int(i+1),11,
float(str(QtGui.QTableWidgetItem.text(Tidal))))
w.get_sheet(0).write(int(i+1),12,
float(str(QtGui.QTableWidgetItem.text(Loop))))
w.get_sheet(0).write(int(i+1),13,
float(str(QtGui.QTableWidgetItem.text(Residual))))
# w.get_sheet(0).write(int(i+1),13,
# str(QtGui.QTableWidgetItem.text(Weight)))
Nrows = self.MainResultsTabview.rowCount()
w.get_sheet(1).write(0, 0, str('Name'))
w.get_sheet(1).write(0, 1, str('Absolute Gravity'))
w.get_sheet(1).write(0, 2, str('Standard Error'))
w.get_sheet(1).write(0, 3, str('Number of Observations'))
w.get_sheet(1).write(0, 4, str('Latitude'))
w.get_sheet(1).write(0, 5, str('Longitude'))
w.get_sheet(1).write(0, 6, str('Elevation'))
w.get_sheet(1).write(0, 7, str('Ellipsoidal gravity'))
w.get_sheet(1).write(0, 8, str('Free air effect'))
w.get_sheet(1).write(0, 9, str('Free air anomaly'))
for i in range(0, Nrows):
Name = self.MainResultsTabview.item(i,0)
Grav = self.MainResultsTabview.item(i,1)
SE = self.MainResultsTabview.item(i,2)
NO = self.MainResultsTabview.item(i,3)
Lat = self.GravityReductionsTab.item(i,2)
Long = self.GravityReductionsTab.item(i,3)
Elev = self.GravityReductionsTab.item(i,4)
Ellg = self.GravityReductionsTab.item(i,5)
FAeff = self.GravityReductionsTab.item(i,6)
FAanom = self.GravityReductionsTab.item(i,7)
w.get_sheet(1).write(int(i+1),0,
str(QtGui.QTableWidgetItem.text(Name)))
w.get_sheet(1).write(int(i+1),1,
float(str(QtGui.QTableWidgetItem.text(Grav))))
w.get_sheet(1).write(int(i+1),2,
float(str(QtGui.QTableWidgetItem.text(SE))))
w.get_sheet(1).write(int(i+1),3,
float(str(QtGui.QTableWidgetItem.text(NO))))
w.get_sheet(1).write(int(i+1),4,
float(str(QtGui.QTableWidgetItem.text(Lat))))
w.get_sheet(1).write(int(i+1),5,
float(str(QtGui.QTableWidgetItem.text(Long))))
w.get_sheet(1).write(int(i+1),6,
float(str(QtGui.QTableWidgetItem.text(Elev))))
w.get_sheet(1).write(int(i+1),7,
float(str(QtGui.QTableWidgetItem.text(Ellg))))
w.get_sheet(1).write(int(i+1),8,
float(str(QtGui.QTableWidgetItem.text(FAeff))))
w.get_sheet(1).write(int(i+1),9,
float(str(QtGui.QTableWidgetItem.text(FAanom))))
w.save(filename+'.xls')
def ExportMainResults(self):
import tkFileDialog
Tk().withdraw()
filename = tkFileDialog.asksaveasfilename()
w = xlwt.Workbook()
Nrows = self.MainResultsTabview.rowCount()
Outpage = w.add_sheet('Absolute Gravity Results',
cell_overwrite_ok=True)
w.get_sheet(0).write(0,0,str('Name'))
w.get_sheet(0).write(0,1,str('Absolute Gravity'))
w.get_sheet(0).write(0,2,str('Standard Error'))
w.get_sheet(0).write(0,3,str('Number of Observations'))
for i in range(0, Nrows):
Name = self.MainResultsTabview.item(i,0)
Grav = self.MainResultsTabview.item(i,1)
SE = self.MainResultsTabview.item(i,2)
NO = self.MainResultsTabview.item(i,3)
w.get_sheet(0).write(int(i+1),0,
str(QtGui.QTableWidgetItem.text(Name)))
w.get_sheet(0).write(int(i+1),1,
float(str(QtGui.QTableWidgetItem.text(Grav))))
w.get_sheet(0).write(int(i+1),2,
float(str(QtGui.QTableWidgetItem.text(SE))))
w.get_sheet(0).write(int(i+1),3,
float(str(QtGui.QTableWidgetItem.text(NO))))
w.save(filename+'.xls')
def RemoveAbsTieForSurvey(self):
Nrows = self.SurveyTies.rowCount()
k = 0;
Gravs = np.zeros((Nrows,1))
Names = strs = ["" for x in range(Nrows)]
for i in range(0, Nrows):
Name = self.SurveyTies.item(i,0)
Grav = self.SurveyTies.item(i,1)
Names[i] = QtGui.QTableWidgetItem.text(Name)
Gravs[i] = float(QtGui.QTableWidgetItem.text(Grav))
if self.SurveyTies.isItemSelected(Name) == False:
k = k+1
self.SurveyTies.setRowCount(k)
k1 = -1
for i in range(0, int(Nrows)):
x = self.SurveyTies.item(i,0)
if self.SurveyTies.isItemSelected(x) == False:
k1 = k1+1
self.SurveyTies.setItem(int(k1),0,
QtGui.QTableWidgetItem(str(Names[i])))
self.SurveyTies.setItem(int(k1),1,
QtGui.QTableWidgetItem(str(float(Gravs[i]))))
def SaveAllAbsGTie(self):
Nrows = self.AbsGTabview.rowCount()
w = xlwt.Workbook()
CalTab2 = w.add_sheet('Sheet1', cell_overwrite_ok=True)
for i in range(0, Nrows):
Name = self.AbsGTabview.item(i,0)
Grav = self.AbsGTabview.item(i,1)
Lat = self.AbsGTabview.item(i,2)
Long = self.AbsGTabview.item(i,3)
w.get_sheet(0).write(i,0,str(QtGui.QTableWidgetItem.text(Name)))
w.get_sheet(0).write(i,1,str(QtGui.QTableWidgetItem.text(Grav)))
w.get_sheet(0).write(i,2,str(QtGui.QTableWidgetItem.text(Lat)))
w.get_sheet(0).write(i,3,str(QtGui.QTableWidgetItem.text(Long)))
w.save('Absolute Gravity/Absolute Gravity.xls')
def AddNewAbsGTie(self):
sw = ctypes.windll.user32.MessageBoxA(0,
'A new space will be added to the Absolute Gravity database table. Remember to click save when you are finished',
'New tie value', 1)
if sw == 1:
Nrows = self.AbsGTabview.rowCount()
Nrowsnew = int(Nrows+1)
self.AbsGTabview.setRowCount(Nrowsnew)
def AddMeasurement(self):
Nrows = self.SurveyDataTab.rowCount()
Nrowsnew = int(Nrows+1)
self.SurveyDataTab.setRowCount(Nrowsnew)
######################################################################################################
#################################### CORE CALCULATION ###############################################
######################################################################################################
def SolveIT(self):
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
# Get the survey data from the table
Nmeasurements = self.SurveyDataTab.rowCount()
Days = np.zeros(Nmeasurements)
Months = np.zeros(Nmeasurements)
Years = np.zeros(Nmeasurements)
Hours = np.zeros(Nmeasurements)
Minutes = np.zeros(Nmeasurements)
MeasurementLats = np.zeros(Nmeasurements)
MeasurementLongs = np.zeros(Nmeasurements)
MeasurementElevs = np.zeros(Nmeasurements)
DialReadings = np.zeros(Nmeasurements)
SurveyedNames = strs = ["" for x in range(Nmeasurements)]
Loops = np.zeros(Nmeasurements)
TidalEffects = np.zeros(Nmeasurements)
TIM = np.zeros(Nmeasurements)
for i in range (0, Nmeasurements):
SurveyedNamesi=self.SurveyDataTab.item(i,0)
Latsi=self.SurveyDataTab.item(i,1)
Longsi=self.SurveyDataTab.item(i,2)
Elevsi=self.SurveyDataTab.item(i,3)
DialReadingsi=self.SurveyDataTab.item(i,4)
Daysi=self.SurveyDataTab.item(i,5)
Monthsi=self.SurveyDataTab.item(i,6)
Yearsi=self.SurveyDataTab.item(i,7)
Hoursi=self.SurveyDataTab.item(i,8)
Minutesi=self.SurveyDataTab.item(i,9)
Loopsi=self.SurveyDataTab.item(i,10)
SurveyedNames[i]=str(QtGui.QTableWidgetItem.text(SurveyedNamesi))
MeasurementLats[i]=float(QtGui.QTableWidgetItem.text(Latsi))
MeasurementLongs[i]=float(QtGui.QTableWidgetItem.text(Longsi))
MeasurementElevs[i]=float(QtGui.QTableWidgetItem.text(Elevsi))
DialReadings[i]=float(QtGui.QTableWidgetItem.text(DialReadingsi))
Days[i]=float(QtGui.QTableWidgetItem.text(Daysi))
Months[i]=float(QtGui.QTableWidgetItem.text(Monthsi))
Years[i]=float(QtGui.QTableWidgetItem.text(Yearsi))
Hours[i]=float(QtGui.QTableWidgetItem.text(Hoursi))
Minutes[i]=float(QtGui.QTableWidgetItem.text(Minutesi))
Loops[i]=float(QtGui.QTableWidgetItem.text(Loopsi))
SiteNames=np.unique(SurveyedNames)
# Get the tie data from the table
Nties=self.SurveyTies.rowCount()
TIENames=strs = ["" for x in range(Nties)]
TIEVals=np.zeros(Nties)
for i in range (0,Nties):
TIENamesi=self.SurveyTies.item(i,0)
TIEValsi=self.SurveyTies.item(i,1)
TIENames[i]=str(QtGui.QTableWidgetItem.text(TIENamesi))
TIEVals[i]=float(QtGui.QTableWidgetItem.text(TIEValsi))
# Calculate tidal effects TIDAL.TIDEFF(Latitude,Longitude,Day,Month,Year,Hour,Minute)
# And calculate the time in minutes for the drift analysis
import TIDAL
for i in range (0,Nmeasurements):
TidalEffects[i]=TIDAL.TIDEFF(MeasurementLats[i],MeasurementLongs[i],int(Days[i]),int(Months[i]),int(Years[i]),Hours[i],Minutes[i])
[JTi,TIMi]=TIDAL.TIMANDJT(int(Days[i]),int(Months[i]),int(Years[i]),Hours[i],Minutes[i])
TIM[i]=TIMi
# get calibration table
wbCal =xlrd.open_workbook('Calibration Tables/G meter Calibration Table.xls')
Sname=self.CalTabSelect.currentText()
CalTab=wbCal.sheet_by_name(Sname)
import CalibrateDial
CalDials=CalibrateDial.Calibrate(DialReadings,CalTab)
# Calculate tide free calibrated dial readings
TideFreeCalDial=CalDials-TidalEffects
# Calculate Absolute gravity at each site and the drift parameters and beta factor
#self.UseLoops.
x=self.UseLoops
import GSOLVER
if QtGui.QCheckBox.isChecked(x)==True:
UL=1
else:
UL=0
Method=self.MethodSelect.currentText()
x=self.CalculateBeta
if QtGui.QCheckBox.isChecked(x)==True:
CB=1
else:
CB=0
if Method=='Method 1: Normal Least Squares' and CB==0:
Betat=self.BetaIne
Beta=float(QtGui.QLineEdit.text(Betat))
TideFreeCalDial=TideFreeCalDial-np.dot(Beta,CalDials)
[ABSG,RES,SiteVar,Drift,BL]=GSOLVER.GsolverM1(TideFreeCalDial,SurveyedNames,SiteNames,TIM,TIENames,TIEVals,Loops,UL)
M=1
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 1: Normal Least Squares' and CB==1:
[ABSG,RES,SiteVar,Beta,Drift,BL]=GSOLVER.GsolverM1Beta(TideFreeCalDial,SurveyedNames,SiteNames,TIM,TIENames,TIEVals,Loops,UL,CalDials)
M=1
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 2: Decoupled Least Squares' and CB==0:
Betat=self.BetaIne
Beta=float(QtGui.QLineEdit.text(Betat))
TideFreeCalDial=TideFreeCalDial-np.dot(Beta,CalDials)
[ABSG,RES,SiteVar,Drift,BL]=GSOLVER.GsolverM2(TideFreeCalDial,SurveyedNames,SiteNames,TIM,TIENames,TIEVals,Loops,UL)
M=2
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 2: Decoupled Least Squares' and CB==1:
[ABSG,RES,SiteVar,Beta,Drift,BL]=GSOLVER.GsolverM2Beta(TideFreeCalDial,SurveyedNames,SiteNames,TIM,TIENames,TIEVals,Loops,UL,CalDials)
M=2
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 3: Constrained Least Squares' and CB==0:
Betat=self.BetaIne
Beta=float(QtGui.QLineEdit.text(Betat))
TideFreeCalDial=TideFreeCalDial-np.dot(Beta,CalDials)
M=3
[ABSG,RES,SiteVar,Drift,BL]=GSOLVER.GsolverM3(TideFreeCalDial,SurveyedNames,SiteNames,TIM,TIENames,TIEVals,Loops,UL)
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 3: Constrained Least Squares' and CB==1:
M=3
[ABSG,RES,SiteVar,Beta,Drift,BL]=GSOLVER.GsolverM3Beta(TideFreeCalDial,SurveyedNames,SiteNames,TIM,TIENames,TIEVals,Loops,UL,CalDials)
self.BetaOut.setText(str(float(Beta)))
##########################################################################################################
# From the resdiuals removed those outside of the specified confidence interval and run again.
#########################################################################################################
RESobs=np.zeros(Nmeasurements)
for k in range(0,Nmeasurements):
RESobs[k]=RES[k]
CIqt=self.ConfInt
CI=float(QtGui.QLineEdit.text(CIqt))
L=np.percentile(RESobs,(100-CI)/2)
M=np.percentile(RESobs,100-(100-CI)/2)
Gcount=0
for i in range(0,Nmeasurements):
if RESobs[i]>=L and RESobs[i]<=M:
Gcount=Gcount+1
TideFreeCalDial2=np.zeros(Gcount)
SurveyedNames2=strs = ["" for x in range(Gcount)]
Loops2=np.zeros(Gcount)
CalDials2=np.zeros(Gcount)
TIM2=np.zeros(Gcount)
MeasurementLats2=np.zeros(Gcount)
MeasurementLongs2=np.zeros(Gcount)
MeasurementElevs2=np.zeros(Gcount)
DialReadings2=np.zeros(Gcount)
Days2=np.zeros(Gcount)
Months2=np.zeros(Gcount)
Years2=np.zeros(Gcount)
Hours2=np.zeros(Gcount)
Minutes2=np.zeros(Gcount)
TidalEffects2=np.zeros(Gcount)
Gcount2=-1
for i in range(0,Nmeasurements):
if RESobs[i]>=L and RESobs[i]<=M:
Gcount2=Gcount2+1
TideFreeCalDial2[Gcount2]=TideFreeCalDial[i]
SurveyedNames2[Gcount2]=SurveyedNames[i]
Loops2[Gcount2]=Loops[i]
CalDials2[Gcount2]=CalDials[i]
TIM2[Gcount2]=TIM[i]
MeasurementLats2[Gcount2]=MeasurementLats[i]
MeasurementLongs2[Gcount2]=MeasurementLongs[i]
MeasurementElevs2[Gcount2]=MeasurementElevs[i]
DialReadings2[Gcount2]=DialReadings[i]
Days2[Gcount2]=Days[i]
Months2[Gcount2]=Months[i]
Years2[Gcount2]=Years[i]
Hours2[Gcount2]=Hours[i]
Minutes2[Gcount2]=Minutes[i]
TidalEffects2[Gcount2]=TidalEffects[i]
Nmeasurements2=Gcount2
SiteNames2=np.unique(SurveyedNames2)
Nsites2=np.size(SiteNames2)
Nsitesorg=np.size(SiteNames)
Nties=np.size(TIENames)
itsok=0
Noties=0
for j in range(0,Nsites2):
for k in range(0,Nties):
if SiteNames2[j]==TIENames[k]:
itsok=1
for j in range(0,Nsitesorg):
for k in range(0,Nties):
if SiteNames[j]==TIENames[k]:
Noties=1
if Nties==0 or Noties==0:
sw=ctypes.windll.user32.MessageBoxA(0, 'Warning: Please add at least one absolute gravity tie station.', 'Warning', 0)
return
if itsok==0:
sw=ctypes.windll.user32.MessageBoxA(0, 'Warning: The are no ties in the survey data after confidence interval filtering, please increase the confidence interval and try again.', 'Warning', 0)
return
if Method=='Method 1: Normal Least Squares' and CB==0:
Betat=self.BetaIne
Beta=float(QtGui.QLineEdit.text(Betat))
TideFreeCalDial=TideFreeCalDial2-np.dot(Beta,CalDials2)
[ABSG2,RES2,SiteVar2,Drift2,BL]=GSOLVER.GsolverM1(TideFreeCalDial2,SurveyedNames2,SiteNames2,TIM2,TIENames,TIEVals,Loops2,UL)
M=1
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 1: Normal Least Squares' and CB==1:
[ABSG2,RES2,SiteVar2,Beta2,Drift2,BL]=GSOLVER.GsolverM1Beta(TideFreeCalDial2,SurveyedNames2,SiteNames2,TIM2,TIENames,TIEVals,Loops2,UL,CalDials2)
M=1
self.BetaOut.setText(str(float(-Beta2)))
if Method=='Method 2: Decoupled Least Squares' and CB==0:
Betat=self.BetaIne
Beta=float(QtGui.QLineEdit.text(Betat))
TideFreeCalDial=TideFreeCalDial2-np.dot(Beta,CalDials2)
[ABSG2,RES2,SiteVar2,Drift2,BL]=GSOLVER.GsolverM2(TideFreeCalDial2,SurveyedNames2,SiteNames2,TIM2,TIENames,TIEVals,Loops2,UL)
M=2
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 2: Decoupled Least Squares' and CB==1:
[ABSG2,RES2,SiteVar2,Beta2,Drift2,BL]=GSOLVER.GsolverM2Beta(TideFreeCalDial2,SurveyedNames2,SiteNames2,TIM2,TIENames,TIEVals,Loops2,UL,CalDials2)
M=2
self.BetaOut.setText(str(float(-Beta2)))
if Method=='Method 3: Constrained Least Squares' and CB==0:
Betat=self.BetaIne
Beta=float(QtGui.QLineEdit.text(Betat))
TideFreeCalDial=TideFreeCalDial2-np.dot(Beta,CalDials2)
M=3
[ABSG2,RES2,SiteVar2,Drift2,BL]=GSOLVER.GsolverM3(TideFreeCalDial2,SurveyedNames2,SiteNames2,TIM2,TIENames,TIEVals,Loops2,UL)
self.BetaOut.setText(str(float(Beta)))
if Method=='Method 3: Constrained Least Squares' and CB==1:
M=3
[ABSG2,RES2,SiteVar2,Beta2,Drift2,BL]=GSOLVER.GsolverM3Beta(TideFreeCalDial2,SurveyedNames2,SiteNames2,TIM2,TIENames,TIEVals,Loops2,UL,CalDials2)
self.BetaOut.setText(str(float(-Beta2)))
TIM=TIM2
global TIM
#######################################################################################################
#######################################################################################################
ELLname=self.Ellipsoidselect.currentText()
if ELLname=='GRS80':
Gamma=978032.67715
k=0.001931851353
e2=0.00669438002290
if ELLname=='GRS67':
Gamma=978031.84558
k=0.001931663383
e2=0.00669460532856
ABSG2=np.round(1000*ABSG2)/1000
SE=np.round(1000*np.sqrt(SiteVar2))/1000
Nsites=np.size(SiteNames2)
self.MainResultsTabview.setRowCount(Nsites)