-
Notifications
You must be signed in to change notification settings - Fork 42
/
thellier_gui.py
executable file
·8993 lines (7701 loc) · 434 KB
/
thellier_gui.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
#!/usr/bin/env pythonw
#============================================================================================
# LOG HEADER:
#============================================================================================
#
# Thellier_GUI Version 2.29 01/29/2015
# 1) fix STDEV-OPT extended error bar plor display bug
# 2) fix paleointensity plot legend when using extended error bars
# 3) fix non-thellier pmag_specimen competability issue
# Thellier_GUI Version 2.28 12/31/2014
# Fix minor bug in delete interpretation buttonn
#
## Thellier_GUI Version 2.27 11/30/2014
#
# Fix in_sigma bug in change criteria dialog box
#
## Thellier_GUI Version 2.26 11/16/2014
# modify code for thellier interpreter
# Add Consistency Check
#
# Thellier_GUI Version 2.25 08/08/2014
# Bug fixes:
# deal with old foramt pmag_criteria.txt when specimen_dang is used as specimen_int_dang;
# deal with import pmag_criteria.txt file with statistics that do not appear in original pmag_criteria.txt
#
#
# Thellier_GUI Version 2.24 05/11/2014
# Fix Pmag results tables issues
#
# Thellier_GUI Version 2.23 05/07/2014
# Fix Pmag results tables issues
#
# Thellier_GUI Version 2.22 04/09/2014
# fix Blab window bug
#
# Thellier_GUI Version 2.21 04/07/2014
# fix bug is scat statistics window
#
# Thellier_GUI Version 2.20 04/04/2014
# add support for pTRM after infield step
#
# Thellier_GUI Version 2.19 03/23/2014
# update dialog boxes with SPD.1.0
#
# Thellier_GUI Version 2.18 03/21/2014
# insert SPD.py.
# some bug fix
#
# Thellier_GUI Version 2.17 03/20/2014
# insert SPD.py.
# merge changes in appearance
#
# Thellier_GUI Version 2.16 03/17/2014
# code cleanup for SPD.1.0 insertion
# change pmag_criteria.txt format to fit MagIC model 2.5
# Thellier_GUI Version 2.15 03/0/2014
# minor changes
# Thellier_GUI Version 2.14 02/28/2014
# minor changes compatibiilty with 64 bit python
# Thellier_GUI Version 2.14 02/28/2014
# minor changes compatibiilty with 64 bit python
# Thellier_GUI Version 2.13 02/25/2014
# Add option for more than one pTRMs one after the other
# Thellier_GUI Version 2.12 0/19/2014
# Fix compatibility issues PC/Mac
# change display preferences
#
# Thellier_GUI Version 2.11 01/13/2014
# adjust diplay to automatically fit screen size
#
# Thellier_GUI Version 2.10 01/13/2014
# Fix compatibility with 64 bit
#
# Thellier_GUI Version 2.09 01/05/2014
# Change STDEV-OPT algorithm from minimizing the standard deviaion to minimzing the precentage of standrd deviation.
# Resize acceptance criterai dialog window
#
# Thellier_GUI Version 2.08 12/04/2013
# Add Additivity checks code
#
# Thellier_GUI Version 2.07 11/04/2013
# Add Thellier-Thellier protocol (thermal, not microwave)
# LP-PI-II
# Add full support to livdb formats TH-PI-IZZI+;MW-PI-C+;MW-PI-C++;MW-PI-IZZI+
#
# Thellier_GUI Version 2.06 10/25/2013
# Add Additivity check (Krasa et al., 2003). Lab treatment code is"
# LT-PTRM-AC
#
# Thellier_GUI Version 2.05 9/02/2013
# Add LP-PI-M-II protocol (microwave Thellier experiment)
#
# Thellier_GUI Version 2.041 7/03/2013
# Bug fix cooling rate corrections
#
# Thellier_GUI Version 2.041 6/14/2013
# Bug fix
#
# Thellier_GUI Version 2.04 6/14/2013
# 1. Add conversion script from generic file format
#
# Thellier_GUI Version 2.03 6/6/2013
# 1. Add cooling rate correction option
#
#
# Thellier_GUI Version 2.02 4/26/2013
# 1. add partial support to Microwave
#
# Thellier_GUI Version 2.01 4/26/2013
# 1. remove defenitions imported from pmag.py, so it can run as stand alone file.
# 2. Add ptrm directions statistics
#
#
#
#-------------------------
#
# Thellier_GUI Version 2.00
# Author: Ron Shaar
# Citation: Shaar and Tauxe (2013)
#
# January 2012: Initial revision
#
#
#============================================================================================
global CURRENT_VRSION
global MICROWAVE
global THERMAL
CURRENT_VRSION = "v.2.29"
MICROWAVE=False
THERMAL=True
import matplotlib
#matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
import sys,pylab,scipy,os
import pmag
##try:
## import pmag
##except:
## pass
try:
import thellier_gui_preferences
except:
pass
import stat
import shutil
import time
import wx
import wx.lib.inspection
import wx.grid
import random
from pylab import * # keep this line for now, but I've tried to add pylab to any pylab functions for better namespacing
from scipy.optimize import curve_fit
import wx.lib.agw.floatspin as FS
try:
from mpl_toolkits.basemap import Basemap, shiftgrid
except:
pass
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
import thellier_consistency_test
import copy
from copy import deepcopy
import thellier_gui_dialogs
import thellier_gui_lib
matplotlib.rc('xtick', labelsize=10)
matplotlib.rc('ytick', labelsize=10)
matplotlib.rc('axes', labelsize=8)
matplotlib.rcParams['savefig.dpi'] = 300.
pylab.rcParams.update({"svg.embed_char_paths":False})
pylab.rcParams.update({"svg.fonttype":'none'})
#============================================================================================
class Arai_GUI(wx.Frame):
""" The main frame of the application
"""
title = "PmagPy Thellier GUI %s"%CURRENT_VRSION
def __init__(self, WD=None, parent=None):
TEXT="""
NAME
thellier_gui.py
DESCRIPTION
GUI for interpreting thellier-type paleointensity data.
For tutorial chcek PmagPy cookbook in http://earthref.org/PmagPy/cookbook/
"""
args=sys.argv
if "-h" in args:
print TEXT
sys.exit()
global FIRST_RUN
FIRST_RUN=True
wx.Frame.__init__(self, parent, wx.ID_ANY, self.title, name='thellier gui')
self.redo_specimens={}
self.currentDirectory = os.getcwd() # get the current working directory
if WD:
self.WD = WD
self.get_DIR(self.WD)
else:
self.get_DIR() # choose directory dialog
# inialize selecting criteria
self.acceptance_criteria=pmag.initialize_acceptance_criteria()
self.add_thellier_gui_criteria()
self.read_criteria_file(os.path.join(self.WD,"pmag_criteria.txt"))
# preferences
preferences=self.get_preferences()
self.dpi = 100
self.preferences=preferences
self.Data,self.Data_hierarchy,self.Data_info={},{},{}
self.MagIC_directories_list=[]
self.Data_info=self.get_data_info() # get all ages, locations etc. (from er_ages, er_sites, er_locations)
self.Data,self.Data_hierarchy=self.get_data() # Get data from magic_measurements and rmag_anistropy if exist.
if "-tree" in sys.argv and FIRST_RUN:
self.open_magic_tree()
self.Data_samples={} # interpretations of samples are kept here
self.Data_sites={} # interpretations of sites are kept here
#self.Data_samples_or_sites={} # interpretations of sites are kept here
self.last_saved_pars={}
self.specimens=self.Data.keys() # get list of specimens
self.specimens.sort() # get list of specimens
self.panel = wx.Panel(self) # make the Panel
self.Main_Frame() # build the main frame
self.create_menu()
try:
self.Arai_zoom()
self.Zij_zoom()
except:
pass
self.arrow_keys()
FIRST_RUN=False
self.get_previous_interpretation() # get interpretations from pmag_specimens.txt
FIRST_RUN=False
self.Bind(wx.EVT_CLOSE, self.on_menu_exit)
self.close_warning=False
def get_DIR(self, WD=None):
"""
open dialog box for choosing a working directory
"""
if "-WD" in sys.argv and FIRST_RUN:
ind=sys.argv.index('-WD')
self.WD=sys.argv[ind+1]
elif not WD: # if no arg was passed in for WD, make a dialog to choose one
dialog = wx.DirDialog(None, "Choose a directory:",defaultPath = self.currentDirectory ,style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON | wx.DD_CHANGE_DIR)
ok = dialog.ShowModal()
if ok == wx.ID_OK:
self.WD=dialog.GetPath()
else:
self.WD = os.getcwd()
dialog.Destroy()
self.magic_file=os.path.join(self.WD,"magic_measurements.txt")
#intialize GUI_log
self.GUI_log=open(os.path.join(self.WD, "thellier_GUI.log"),'w')
self.GUI_log.write("starting...\n")
self.GUI_log=open(os.path.join(self.WD, "thellier_GUI.log"),'a')
os.chdir(self.WD)
self.WD=os.getcwd()
def Main_Frame(self):
"""
Build main frame od panel: buttons, etc.
choose the first specimen and display data
"""
#----------------------------------------------------------------------
# initialize first specimen in list as current specimen
#----------------------------------------------------------------------
try:
self.s=self.specimens[0]
except:
self.s=""
#----------------------------------------------------------------------
# create main panel in the right size
#----------------------------------------------------------------------
dw, dh = wx.DisplaySize()
w, h = self.GetSize()
#print 'diplay', dw, dh
#print "gui", w, h
r1=dw/1250.
r2=dw/750.
#if dw>w:
GUI_RESOLUTION=min(r1,r2,1.3)
if 'gui_resolution' in self.preferences.keys():
if float(self.preferences['gui_resolution'])!=1:
#self.GUI_RESOLUTION=0.75
self.GUI_RESOLUTION=float(self.preferences['gui_resolution'])/100
else:
self.GUI_RESOLUTION=min(r1,r2,1.3)
else:
self.GUI_RESOLUTION=min(r1,r2,1.3)
#----------------------------------------------------------------------
# adjust font size
#----------------------------------------------------------------------
if self.GUI_RESOLUTION >= 1.1 and self.GUI_RESOLUTION <= 1.3:
font2 = wx.Font(13, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
elif self.GUI_RESOLUTION <= 0.9 and self.GUI_RESOLUTION < 1.0 :
font2 = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
elif self.GUI_RESOLUTION <= 0.9 :
font2 = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
else:
font2 = wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
print " self.GUI_RESOLUTION",self.GUI_RESOLUTION
# set font size and style
#font1 = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Comic Sans MS')
FONT_RATIO=self.GUI_RESOLUTION+(self.GUI_RESOLUTION-1)*5
font1 = wx.Font(9+FONT_RATIO, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
# GUI headers
font3 = wx.Font(11+FONT_RATIO, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
font.SetPointSize(10+FONT_RATIO)
#----------------------------------------------------------------------
# Create Figures and FigCanvas objects.
#----------------------------------------------------------------------
self.fig1 = pylab.Figure((5.*self.GUI_RESOLUTION, 5.*self.GUI_RESOLUTION), dpi=self.dpi)
self.canvas1 = FigCanvas(self.panel, -1, self.fig1)
self.fig1.text(0.01,0.98,"Arai plot",{'family':'Arial', 'fontsize':10, 'style':'normal','va':'center', 'ha':'left' })
self.fig2 = pylab.Figure((2.5*self.GUI_RESOLUTION, 2.5*self.GUI_RESOLUTION), dpi=self.dpi)
self.canvas2 = FigCanvas(self.panel, -1, self.fig2)
self.fig2.text(0.02,0.96,"Zijderveld",{'family':'Arial', 'fontsize':10, 'style':'normal','va':'center', 'ha':'left' })
self.fig3 = pylab.Figure((2.5*self.GUI_RESOLUTION, 2.5*self.GUI_RESOLUTION), dpi=self.dpi)
self.canvas3 = FigCanvas(self.panel, -1, self.fig3)
#self.fig3.text(0.02,0.96,"Equal area",{'family':'Arial', 'fontsize':10*self.GUI_RESOLUTION, 'style':'normal','va':'center', 'ha':'left' })
self.fig4 = pylab.Figure((2.5*self.GUI_RESOLUTION, 2.5*self.GUI_RESOLUTION), dpi=self.dpi)
self.canvas4 = FigCanvas(self.panel, -1, self.fig4)
if self.acceptance_criteria['average_by_sample_or_site']['value']=='site':
TEXT="Site data"
else:
TEXT="Sample data"
self.fig4.text(0.02,0.96,TEXT,{'family':'Arial', 'fontsize':10, 'style':'normal','va':'center', 'ha':'left' })
self.fig5 = pylab.Figure((2.5*self.GUI_RESOLUTION, 2.5*self.GUI_RESOLUTION), dpi=self.dpi)
self.canvas5 = FigCanvas(self.panel, -1, self.fig5)
#self.fig5.text(0.02,0.96,"M/M0",{'family':'Arial', 'fontsize':10, 'style':'normal','va':'center', 'ha':'left' })
# make axes of the figures
self.araiplot = self.fig1.add_axes([0.1,0.1,0.8,0.8])
self.zijplot = self.fig2.add_subplot(111)
self.eqplot = self.fig3.add_subplot(111)
self.sampleplot = self.fig4.add_axes([0.2,0.3,0.7,0.6],frameon=True,axisbg='None')
self.mplot = self.fig5.add_axes([0.2,0.15,0.7,0.7],frameon=True,axisbg='None')
#----------------------------------------------------------------------
# text box displaying measurement data
#----------------------------------------------------------------------
self.logger = wx.TextCtrl(self.panel, id=-1, size=(200*self.GUI_RESOLUTION,500*self.GUI_RESOLUTION), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL)
self.logger.SetFont(font1)
#----------------------------------------------------------------------
# select a specimen box
#----------------------------------------------------------------------
box_sizer_select_specimen = wx.StaticBoxSizer( wx.StaticBox( self.panel, wx.ID_ANY,"specimen" ), wx.VERTICAL )
# Combo-box with a list of specimen
self.specimens_box = wx.ComboBox(self.panel, -1, self.s, (250*self.GUI_RESOLUTION, 25), wx.DefaultSize,self.specimens, wx.CB_DROPDOWN,name="specimen")
self.specimens_box.SetFont(font2)
self.Bind(wx.EVT_COMBOBOX, self.onSelect_specimen,self.specimens_box)
# buttons to move forward and backwards from specimens
self.nextbutton = wx.Button(self.panel, id=-1, label='next',size=(75*self.GUI_RESOLUTION, 25))#,style=wx.BU_EXACTFIT)#, size=(175, 28))
self.Bind(wx.EVT_BUTTON, self.on_next_button, self.nextbutton)
self.nextbutton.SetFont(font2)
self.prevbutton = wx.Button(self.panel, id=-1, label='previous',size=(75*self.GUI_RESOLUTION, 25))#,style=wx.BU_EXACTFIT)#, size=(175, 28))
self.prevbutton.SetFont(font2)
self.Bind(wx.EVT_BUTTON, self.on_prev_button, self.prevbutton)
select_specimen_window = wx.GridSizer(1, 2, 0, 10*self.GUI_RESOLUTION)
select_specimen_window.AddMany( [(self.prevbutton, wx.ALIGN_LEFT),
(self.nextbutton, wx.ALIGN_LEFT)])
select_specimen_window_2 = wx.GridSizer(2, 1, 6, 10*self.GUI_RESOLUTION)
select_specimen_window_2.AddMany( [(self.specimens_box, wx.ALIGN_LEFT),
(select_specimen_window, wx.ALIGN_LEFT)])
box_sizer_select_specimen.Add(select_specimen_window_2, 0, wx.TOP, 0 )
#----------------------------------------------------------------------
# select temperature bounds
#----------------------------------------------------------------------
if self.s in self.Data.keys() and self.Data[self.s]['T_or_MW']=="T":
box_sizer_select_temp = wx.StaticBoxSizer( wx.StaticBox( self.panel, wx.ID_ANY,"temperatures" ), wx.HORIZONTAL )
else:
box_sizer_select_temp = wx.StaticBoxSizer( wx.StaticBox( self.panel, wx.ID_ANY,"MW power" ), wx.HORIZONTAL )
try:
if self.Data[self.s]['T_or_MW']=="T":
self.temperatures=scipy.array(self.Data[self.s]['t_Arai'])-273.
self.T_list=["%.0f"%T for T in self.temperatures]
elif self.Data[self.s]['T_or_MW']=="MW":
self.temperatures=scipy.array(self.Data[self.s]['t_Arai'])
self.T_list=["%.0f"%T for T in self.temperatures]
except:
self.T_list=[]
self.tmin_box = wx.ComboBox(self.panel, -1 ,size=(100*self.GUI_RESOLUTION, 25),choices=self.T_list, style=wx.CB_DROPDOWN)
self.Bind(wx.EVT_COMBOBOX, self.get_new_T_PI_parameters,self.tmin_box)
self.tmax_box = wx.ComboBox(self.panel, -1 ,size=(100*self.GUI_RESOLUTION, 25),choices=self.T_list, style=wx.CB_DROPDOWN)
self.Bind(wx.EVT_COMBOBOX, self.get_new_T_PI_parameters,self.tmax_box)
select_temp_window = wx.GridSizer(2, 1, 12, 10*self.GUI_RESOLUTION)
select_temp_window.AddMany( [(self.tmin_box, wx.ALIGN_LEFT),
(self.tmax_box, wx.ALIGN_LEFT)])
box_sizer_select_temp.Add(select_temp_window, 0, wx.TOP, 0 )
#----------------------------------------------------------------------
# save/delete buttons
#----------------------------------------------------------------------
box_sizer_save = wx.StaticBoxSizer( wx.StaticBox( self.panel, wx.ID_ANY,"" ), wx.HORIZONTAL )
# save/delete interpretation buttons
self.save_interpretation_button = wx.Button(self.panel, id=-1, label='save',size=(75*self.GUI_RESOLUTION,25))#,style=wx.BU_EXACTFIT)#, size=(175, 28))
self.save_interpretation_button.SetFont(font2)
self.delete_interpretation_button = wx.Button(self.panel, id=-1, label='delete',size=(75*self.GUI_RESOLUTION,25))#,style=wx.BU_EXACTFIT)#, size=(175, 28))
self.delete_interpretation_button.SetFont(font2)
self.Bind(wx.EVT_BUTTON, self.on_save_interpretation_button, self.save_interpretation_button)
self.Bind(wx.EVT_BUTTON, self.on_delete_interpretation_button, self.delete_interpretation_button)
save_delete_window = wx.GridSizer(2, 1, 14, 20*self.GUI_RESOLUTION)
save_delete_window.AddMany( [(self.save_interpretation_button, wx.ALIGN_LEFT),
(self.delete_interpretation_button, wx.ALIGN_LEFT)])
box_sizer_save.Add(save_delete_window, 0, wx.TOP, 0 )
#----------------------------------------------------------------------
# specimen interpretation and statistics window (Blab; Banc, Dec, Inc, correction factors etc.)
#----------------------------------------------------------------------
self.Blab_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))
#self.Blab_window.SetFont(font2)
self.Banc_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))
#self.Banc_window.SetFont(font2)
self.Aniso_factor_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))
#self.Aniso_factor_window.SetFont(font2)
self.NLT_factor_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))
#self.NLT_factor_window.SetFont(font2)
self.CR_factor_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))
#self.CR_factor_window.SetFont(font2)
self.declination_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))
#self.declination_window.SetFont(font2)
self.inclination_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))
#self.inclination_window.SetFont(font2)
self.Blab_label=wx.StaticText(self.panel,label="\nB_lab",style=wx.ALIGN_CENTRE)
self.Blab_label.SetFont(font2)
self.Banc_label=wx.StaticText(self.panel,label="\nB_anc",style=wx.ALIGN_CENTRE)
self.Banc_label.SetFont(font2)
self.aniso_corr_label=wx.StaticText(self.panel,label="Aniso\ncorr",style=wx.ALIGN_CENTRE)
self.aniso_corr_label.SetFont(font2)
self.nlt_corr_label=wx.StaticText(self.panel,label="NLT\ncorr",style=wx.ALIGN_CENTRE)
self.nlt_corr_label.SetFont(font2)
self.cr_corr_label=wx.StaticText(self.panel,label="CR\ncorr",style=wx.ALIGN_CENTRE)
self.cr_corr_label.SetFont(font2)
self.dec_label=wx.StaticText(self.panel,label="\nDec",style=wx.ALIGN_CENTRE)
self.dec_label.SetFont(font2)
self.inc_label=wx.StaticText(self.panel,label="\nInc",style=wx.ALIGN_CENTRE)
self.inc_label.SetFont(font2)
specimen_stat_window = wx.GridSizer(2, 7, 0, 20*self.GUI_RESOLUTION)
box_sizer_specimen = wx.StaticBoxSizer( wx.StaticBox( self.panel, wx.ID_ANY,"specimen results" ), wx.HORIZONTAL )
specimen_stat_window.AddMany( [(self.Blab_label, wx.EXPAND),
((self.Banc_label), wx.EXPAND),
((self.aniso_corr_label), wx.EXPAND),
((self.nlt_corr_label),wx.EXPAND),
((self.cr_corr_label),wx.EXPAND),
((self.dec_label),wx.TE_CENTER),
((self.inc_label),wx.EXPAND),
(self.Blab_window, wx.EXPAND),
(self.Banc_window, wx.EXPAND) ,
(self.Aniso_factor_window, wx.EXPAND) ,
(self.NLT_factor_window, wx.EXPAND),
(self.CR_factor_window, wx.EXPAND),
(self.declination_window, wx.EXPAND) ,
(self.inclination_window, wx.EXPAND)])
box_sizer_specimen.Add( specimen_stat_window, 0, wx.ALIGN_LEFT, 0 )
#----------------------------------------------------------------------
# Sample interpretation window
#----------------------------------------------------------------------
for key in ["sample_int_n","sample_int_uT","sample_int_sigma","sample_int_sigma_perc"]:
command="self.%s_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))"%key
exec command
sample_mean_label=wx.StaticText(self.panel,label="\nmean",style=wx.TE_CENTER)
sample_mean_label.SetFont(font2)
sample_N_label=wx.StaticText(self.panel,label="\nN ",style=wx.TE_CENTER)
sample_N_label.SetFont(font2)
sample_std_label=wx.StaticText(self.panel,label="\n std uT",style=wx.TE_CENTER)
sample_std_label.SetFont(font2)
sample_std_per_label=wx.StaticText(self.panel,label="\n std %",style=wx.TE_CENTER)
sample_std_per_label.SetFont(font2)
sample_stat_window = wx.GridSizer(2, 4, 0, 20*self.GUI_RESOLUTION)
box_sizer_sample = wx.StaticBoxSizer( wx.StaticBox( self.panel, wx.ID_ANY,"sample/site results" ), wx.HORIZONTAL )
sample_stat_window.AddMany( [(sample_mean_label, wx.EXPAND),
(sample_N_label, wx.EXPAND),
(sample_std_label, wx.EXPAND),
(sample_std_per_label ,wx.EXPAND),
(self.sample_int_uT_window, wx.EXPAND),
(self.sample_int_n_window, wx.EXPAND) ,
(self.sample_int_sigma_window, wx.EXPAND) ,
(self.sample_int_sigma_perc_window, wx.EXPAND)])
box_sizer_sample.Add(sample_stat_window, 0, wx.ALIGN_LEFT, 0 )
hbox_criteria = wx.BoxSizer(wx.HORIZONTAL)
TEXT=[" ","Acceptance criteria:","Specimen statistics:"]
for i in range(len(TEXT)):
command="self.label_%i=wx.StaticText(self.panel,label='%s',style=wx.ALIGN_CENTER,size=(180,25))"%(i,TEXT[i])
exec command
gs1 = wx.GridSizer(3, 1,5*self.GUI_RESOLUTION,5*self.GUI_RESOLUTION)
gs1.AddMany( [(self.label_0,wx.EXPAND),(self.label_1,wx.EXPAND),(self.label_2,wx.EXPAND)])
hbox_criteria.Add(gs1,flag=wx.ALIGN_LEFT)
for statistic in self.preferences['show_statistics_on_gui']:
command="self.%s_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))"%statistic
exec command
command="self.%s_window.SetFont(font2)"%statistic
exec command
command="self.%s_threshold_window=wx.TextCtrl(self.panel,style=wx.TE_CENTER|wx.TE_READONLY,size=(50*self.GUI_RESOLUTION,25))"%statistic
exec command
command="self.%s_threshold_window.SetFont(font2)"%statistic
exec command
command="self.%s_threshold_window.SetBackgroundColour(wx.NullColour)"%statistic
exec command
command="self.%s_label=wx.StaticText(self.panel,label='%s',style=wx.ALIGN_CENTRE)"%(statistic,statistic.replace("specimen_","").replace("int_",""))
exec command
command="self.%s_label.SetFont(font2)"%statistic
exec command
for statistic in self.preferences['show_statistics_on_gui']:
command="gs_%s = wx.GridSizer(3, 1,5*self.GUI_RESOLUTION,5*self.GUI_RESOLUTION)"%statistic
exec command
command="gs_%s.AddMany( [(self.%s_label,wx.EXPAND),(self.%s_threshold_window,wx.EXPAND),(self.%s_window,wx.EXPAND)])"%(statistic,statistic,statistic,statistic)
exec command
command="hbox_criteria.Add(gs_%s,flag=wx.ALIGN_LEFT)"%statistic
exec command
hbox_criteria.AddSpacer(12)
# ---------------------------
# write acceptance criteria to boxes
# ---------------------------
self.write_acceptance_criteria_to_boxes() # write threshold values to boxes
#----------------------------------------------------------------------
# Design the panel
#----------------------------------------------------------------------
vbox1 = wx.BoxSizer(wx.VERTICAL)
hbox1 = wx.BoxSizer(wx.HORIZONTAL)
vbox1.AddSpacer(10)
hbox1.AddSpacer(2)
hbox1.Add(box_sizer_select_specimen,flag=wx.ALIGN_LEFT|wx.ALIGN_BOTTOM)
hbox1.AddSpacer(2)
hbox1.Add(box_sizer_select_temp, flag=wx.ALIGN_LEFT|wx.ALIGN_BOTTOM)
hbox1.AddSpacer(2)
hbox1.Add(box_sizer_save, flag=wx.ALIGN_LEFT|wx.ALIGN_BOTTOM)
hbox1.AddSpacer(2)
hbox1.Add(box_sizer_specimen, flag=wx.ALIGN_LEFT|wx.ALIGN_BOTTOM)
hbox1.AddSpacer(2)
hbox1.Add(box_sizer_sample, flag=wx.ALIGN_LEFT|wx.ALIGN_BOTTOM)
hbox1.AddSpacer(2)
vbox1.Add(hbox1, flag=wx.ALIGN_LEFT, border=8)
self.panel.SetSizer(vbox1)
vbox2a=wx.BoxSizer(wx.VERTICAL)
#vbox2a.Add(self.toolbar1,flag=wx.ALIGN_TOP,border=8)
vbox2a.Add(self.logger,flag=wx.ALIGN_TOP,border=8)
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
hbox2.Add(vbox2a,flag=wx.ALIGN_CENTER_HORIZONTAL)#,border=8)
hbox2.Add(self.canvas1,flag=wx.ALIGN_CENTER_HORIZONTAL)#,border=8)
vbox2 = wx.BoxSizer(wx.VERTICAL)
vbox2.Add(self.canvas2,flag=wx.ALIGN_LEFT)#,border=8)
vbox2.Add(self.canvas3,flag=wx.ALIGN_LEFT)#,border=8)
vbox3 = wx.BoxSizer(wx.VERTICAL)
vbox3.Add(self.canvas4,flag=wx.ALIGN_LEFT|wx.ALIGN_TOP)#,border=8)
vbox3.Add(self.canvas5,flag=wx.ALIGN_LEFT|wx.ALIGN_TOP)#,border=8)
hbox2.Add(vbox2,flag=wx.ALIGN_CENTER_HORIZONTAL)#,border=8)
hbox2.Add(vbox3,flag=wx.ALIGN_CENTER_HORIZONTAL)#,border=8)
vbox1.Add(hbox2, flag=wx.LEFT, border=8)
hbox_test = wx.BoxSizer(wx.HORIZONTAL)
vbox1.AddSpacer(5)
vbox1.Add(hbox_criteria,flag=wx.LEFT)
vbox1.AddSpacer(20)
self.panel.SetSizer(vbox1)
vbox1.Fit(self)
#----------------------------------------------------------------------
# Draw figures and add text
#----------------------------------------------------------------------
try:
self.draw_figure(self.s) # draw the figures
self.Add_text(self.s) # write measurement data to text box
except:
pass
#----------------------------------------------------------------------
def on_save_interpretation_button(self,event):
"""
save the current interpretation temporarily (not to a file)
"""
if "specimen_int_uT" not in self.Data[self.s]['pars']:
return
self.Data[self.s]['pars']['saved']=True
# collect all interpretation by sample
sample=self.Data_hierarchy['specimens'][self.s]
if sample not in self.Data_samples.keys():
self.Data_samples[sample]={}
if self.s not in self.Data_samples[sample].keys():
self.Data_samples[sample][self.s]={}
self.Data_samples[sample][self.s]['B']=self.Data[self.s]['pars']["specimen_int_uT"]
# collect all interpretation by site
site=thellier_gui_lib.get_site_from_hierarchy(sample,self.Data_hierarchy)
if site not in self.Data_sites.keys():
self.Data_sites[site]={}
if self.s not in self.Data_sites[site].keys():
self.Data_sites[site][self.s]={}
self.Data_sites[site][self.s]['B']=self.Data[self.s]['pars']["specimen_int_uT"]
self.draw_sample_mean()
self.write_sample_box()
self.close_warning=True
def on_delete_interpretation_button(self,event):
"""
delete the current interpretation temporarily (not to a file)
"""
del self.Data[self.s]['pars']
self.Data[self.s]['pars']={}
self.Data[self.s]['pars']['lab_dc_field']=self.Data[self.s]['lab_dc_field']
self.Data[self.s]['pars']['er_specimen_name']=self.Data[self.s]['er_specimen_name']
self.Data[self.s]['pars']['er_sample_name']=self.Data[self.s]['er_sample_name']
self.Data[self.s]['pars']['er_sample_name']=self.Data[self.s]['er_sample_name']
sample=self.Data_hierarchy['specimens'][self.s]
if sample in self.Data_samples.keys():
if self.s in self.Data_samples[sample].keys():
if 'B' in self.Data_samples[sample][self.s].keys():
del self.Data_samples[sample][self.s]['B']
site=thellier_gui_lib.get_site_from_hierarchy(sample,self.Data_hierarchy)
if site in self.Data_sites.keys():
if self.s in self.Data_sites[site].keys():
del self.Data_sites[site][self.s]['B']
#if 'B' in self.Data_sites[site][self.s].keys():
# del self.Data_sites[site][self.s]['B']
self.tmin_box.SetValue("")
self.tmax_box.SetValue("")
self.clear_boxes()
self.draw_figure(self.s)
self.draw_sample_mean()
self.write_sample_box()
self.close_warning=True
#----------------------------------------------------------------------
def write_acceptance_criteria_to_boxes(self):
"""
Update paleointensity statistics in acceptance criteria boxes.
(after changing temperature bounds or changing specimen)
"""
self.ignore_parameters={}
for crit_short_name in self.preferences['show_statistics_on_gui']:
crit="specimen_"+crit_short_name
if self.acceptance_criteria[crit]['value']==-999:
command="self.%s_threshold_window.SetValue(\"\")"%crit_short_name
exec command
command="self.%s_threshold_window.SetBackgroundColour(wx.Colour(128, 128, 128))"%crit_short_name
exec command
self.ignore_parameters[crit]=True
continue
elif crit=="specimen_scat":
if self.acceptance_criteria[crit]['value'] in ['g',1,'1',True,"True"]:
value="True"
#self.scat_threshold_window.SetBackgroundColour(wx.Colour(128, 128, 128))
else:
value=""
self.scat_threshold_window.SetBackgroundColour(wx.Colour(128, 128, 128))
elif type(self.acceptance_criteria[crit]['value'])==int:
value="%i"%self.acceptance_criteria[crit]['value']
elif type(self.acceptance_criteria[crit]['value'])==float:
if self.acceptance_criteria[crit]['decimal_points']==-999:
value="%.3e"%self.acceptance_criteria[crit]['value']
else:
command="value='%%.%if'%%self.acceptance_criteria[crit]['value']"%(self.acceptance_criteria[crit]['decimal_points'])
exec command
else:
continue
command="self.%s_threshold_window.SetValue('%s')"%(crit_short_name,value)
exec command
command="self.%s_threshold_window.SetBackgroundColour(wx.WHITE)"%crit_short_name
exec command
#----------------------------------------------------------------------
def Add_text(self,s):
"""
Add text to measurement data window.
"""
self.logger.Clear()
FONT_RATIO=self.GUI_RESOLUTION+(self.GUI_RESOLUTION-1)*5
if self.GUI_RESOLUTION >1.1:
font1 = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
elif self.GUI_RESOLUTION <=0.9:
font1 = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
else:
font1 = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')
#String="Step | Temp | Dec | Inc | M [Am^2]\n"
String=" Step\tTemp\t Dec\t Inc\tM [Am^2]\n"
# microwave
if "LP-PI-M" in self.Data[self.s]['datablock'][0]['magic_method_codes']:
MICROWAVE=True; THERMAL=False
String=" Step\tNumber\t Dec\t Inc\tMoment\n"
else:
MICROWAVE=False; THERMAL=True
self.logger.AppendText(String)
self.logger.SetFont(font1)
TEXT=""
for rec in self.Data[self.s]['datablock']:
#print rec.keys()
if "LT-NO" in rec['magic_method_codes']:
step="N"
elif "LT-AF-Z" in rec['magic_method_codes']:
step="AFD"
elif "LT-T-Z" in rec['magic_method_codes'] or 'LT-M-Z' in rec['magic_method_codes']:
step="Z"
elif "LT-T-I" in rec['magic_method_codes'] or 'LT-M-I' in rec['magic_method_codes']:
step="I"
elif "LT-PTRM-I" in rec['magic_method_codes'] or "LT-PMRM-I" in rec['magic_method_codes']:
step="P"
elif "LT-PTRM-MD" in rec['magic_method_codes'] or "LT-PMRM-MD" in rec['magic_method_codes']:
step="T"
elif "LT-PTRM-AC" in rec['magic_method_codes'] or "LT-PMRM-AC" in rec['magic_method_codes']:
step="A"
else:
print "unrecognized step in specimen",self.s," Method codes: ", rec['magic_method_codes']
if THERMAL:
TEXT=TEXT+" %s\t%3.0f\t%5.1f\t%5.1f\t%.2e\n"%(step,float(rec['treatment_temp'])-273.,float(rec['measurement_dec']),float(rec['measurement_inc']),float(rec['measurement_magn_moment']))
# TEXT=TEXT+" %s %3.0f %5.1f %5.1f %.2e\n"%(step,float(rec['treatment_temp'])-273.,float(rec['measurement_dec']),float(rec['measurement_inc']),float(rec['measurement_magn_moment']))
elif MICROWAVE: # mcrowave
if "measurement_description" in rec.keys():
MW_step=rec["measurement_description"].strip('\n').split(":")
for STEP in MW_step:
if "Number" in STEP:
temp=float(STEP.split("-")[-1])
TEXT=TEXT+" %s\t%1.0f\t%5.1f\t%5.1f\t%.2e\n"%(step,temp,float(rec['measurement_dec']),float(rec['measurement_inc']),float(rec['measurement_magn_moment']))
self.logger.AppendText( TEXT)
#----------------------------------------------------------------------
def create_menu(self):
"""
Create menu bar
"""
self.menubar = wx.MenuBar()
menu_preferences = wx.Menu()
m_preferences_apperance = menu_preferences.Append(-1, "&Appearence preferences", "")
self.Bind(wx.EVT_MENU, self.on_menu_appearance_preferences, m_preferences_apperance)
m_preferences_spd = menu_preferences.Append(-1, "&Specimen paleointensity statistics (from SPD list)", "")
self.Bind(wx.EVT_MENU, self.on_menu_m_preferences_spd, m_preferences_spd)
#m_preferences_stat = menu_preferences.Append(-1, "&Statistical preferences", "")
#self.Bind(wx.EVT_MENU, self.on_menu_preferences_stat, m_preferences_stat)
#m_save_preferences = menu_preferences.Append(-1, "&Save preferences", "")
#self.Bind(wx.EVT_MENU, self.on_menu_save_preferences, m_save_preferences)
menu_file = wx.Menu()
m_change_working_directory = menu_file.Append(-1, "&Change project directory", "")
self.Bind(wx.EVT_MENU, self.on_menu_change_working_directory, m_change_working_directory)
#m_add_working_directory = menu_file.Append(-1, "&Add a MagIC project directory", "")
#self.Bind(wx.EVT_MENU, self.on_menu_add_working_directory, m_add_working_directory)
m_open_magic_file = menu_file.Append(-1, "&Open MagIC measurement file", "")
self.Bind(wx.EVT_MENU, self.on_menu_open_magic_file, m_open_magic_file)
m_open_magic_tree = menu_file.Append(-1, "&Open all MagIC project directories in path", "")
self.Bind(wx.EVT_MENU, self.on_menu_m_open_magic_tree, m_open_magic_tree)
menu_file.AppendSeparator()
m_prepare_MagIC_results_tables= menu_file.Append(-1, "&Save MagIC pmag tables", "")
self.Bind(wx.EVT_MENU, self.on_menu__prepare_MagIC_results_tables, m_prepare_MagIC_results_tables)
submenu_save_plots = wx.Menu()
m_save_Arai_plot = submenu_save_plots.Append(-1, "&Save Arai plot", "")
self.Bind(wx.EVT_MENU, self.on_save_Arai_plot, m_save_Arai_plot)
m_save_zij_plot = submenu_save_plots.Append(-1, "&Save Zijderveld plot", "")
self.Bind(wx.EVT_MENU, self.on_save_Zij_plot, m_save_zij_plot,"Zij")
m_save_eq_plot = submenu_save_plots.Append(-1, "&Save equal area plot", "")
self.Bind(wx.EVT_MENU, self.on_save_Eq_plot, m_save_eq_plot,"Eq")
m_save_M_t_plot = submenu_save_plots.Append(-1, "&Save M-t plot", "")
self.Bind(wx.EVT_MENU, self.on_save_M_t_plot, m_save_M_t_plot,"M_t")
m_save_NLT_plot = submenu_save_plots.Append(-1, "&Save NLT plot", "")
self.Bind(wx.EVT_MENU, self.on_save_NLT_plot, m_save_NLT_plot,"NLT")
m_save_CR_plot = submenu_save_plots.Append(-1, "&Save cooling rate plot", "")
self.Bind(wx.EVT_MENU, self.on_save_CR_plot, m_save_CR_plot,"CR")
m_save_sample_plot = submenu_save_plots.Append(-1, "&Save sample plot", "")
self.Bind(wx.EVT_MENU, self.on_save_sample_plot, m_save_sample_plot,"Samp")
#m_save_all_plots = submenu_save_plots.Append(-1, "&Save all plots", "")
#self.Bind(wx.EVT_MENU, self.on_save_all_plots, m_save_all_plots)
menu_file.AppendSeparator()
m_new_sub_plots = menu_file.AppendMenu(-1, "&Save plot", submenu_save_plots)
menu_file.AppendSeparator()
m_exit = menu_file.Append(wx.ID_EXIT, "Quit", "Quit application")
self.Bind(wx.EVT_MENU, self.on_menu_exit, m_exit)
menu_anistropy = wx.Menu()
m_calculate_aniso_tensor = menu_anistropy.Append(-1, "&Calculate anistropy tensors", "")
self.Bind(wx.EVT_MENU, self.on_menu_calculate_aniso_tensor, m_calculate_aniso_tensor)
m_show_anisotropy_errors = menu_anistropy.Append(-1, "&Show anisotropy calculation Warnings/Errors", "")
self.Bind(wx.EVT_MENU, self.on_show_anisotropy_errors, m_show_anisotropy_errors)
menu_Analysis = wx.Menu()
submenu_criteria = wx.Menu()
# m_set_criteria_to_default = submenu_criteria.Append(-1, "&Set acceptance criteria to default", "")
# self.Bind(wx.EVT_MENU, self.on_menu_default_criteria, m_set_criteria_to_default)
m_change_criteria_file = submenu_criteria.Append(-1, "&Change acceptance criteria", "")
self.Bind(wx.EVT_MENU, self.on_menu_criteria, m_change_criteria_file)
m_import_criteria_file = submenu_criteria.Append(-1, "&Import criteria file", "")
self.Bind(wx.EVT_MENU, self.on_menu_criteria_file, m_import_criteria_file)
m_new_sub = menu_Analysis.AppendMenu(-1, "Acceptance criteria", submenu_criteria)
m_previous_interpretation = menu_Analysis.Append(-1, "&Import previous interpretation from a 'redo' file", "")
self.Bind(wx.EVT_MENU, self.on_menu_previous_interpretation, m_previous_interpretation)
m_save_interpretation = menu_Analysis.Append(-1, "&Save current interpretations to a 'redo' file", "")
self.Bind(wx.EVT_MENU, self.on_menu_save_interpretation, m_save_interpretation)
m_delete_interpretation = menu_Analysis.Append(-1, "&Clear all current interpretations", "")
self.Bind(wx.EVT_MENU, self.on_menu_clear_interpretation, m_delete_interpretation)
menu_Tools = wx.Menu()
#m_prev_interpretation = menu_file.Append(-1, "&Save plot\tCtrl-S", "Save plot to file")
menu_Auto_Interpreter = wx.Menu()
m_interpreter = menu_Auto_Interpreter.Append(-1, "&Run Thellier auto interpreter", "Run auto interpter")
self.Bind(wx.EVT_MENU, self.on_menu_run_interpreter, m_interpreter)
m_open_interpreter_file = menu_Auto_Interpreter.Append(-1, "&Open auto-interpreter output files", "")
self.Bind(wx.EVT_MENU, self.on_menu_open_interpreter_file, m_open_interpreter_file)
m_open_interpreter_log = menu_Auto_Interpreter.Append(-1, "&Open auto-interpreter Warnings/Errors", "")
self.Bind(wx.EVT_MENU, self.on_menu_open_interpreter_log, m_open_interpreter_log)
menu_consistency_test = wx.Menu()
m_run_consistency_test = menu_consistency_test.Append(-1, "&Run Consistency test", "")
self.Bind(wx.EVT_MENU, self.on_menu_run_consistency_test, m_run_consistency_test)
#m_run_consistency_test_b = menu_Optimizer.Append(-1, "&Run Consistency test beta version", "")
#self.Bind(wx.EVT_MENU, self.on_menu_run_consistency_test_b, m_run_consistency_test_b)
menu_Plot= wx.Menu()
m_plot_data = menu_Plot.Append(-1, "&Plot paleointensity curve", "")
self.Bind(wx.EVT_MENU, self.on_menu_plot_data, m_plot_data)
menu_results_table= wx.Menu()
m_make_results_table = menu_results_table.Append(-1, "&Make results table", "")
self.Bind(wx.EVT_MENU, self.on_menu_results_data, m_make_results_table)
#menu_MagIC= wx.Menu()
#m_convert_to_magic= menu_MagIC.Append(-1, "&Convert generic files to MagIC format", "")
#self.Bind(wx.EVT_MENU, self.on_menu_convert_to_magic, m_convert_to_magic)