source: trunk/GSASIIddataGUI.py @ 1751

Last change on this file since 1751 was 1731, checked in by vondreele, 10 years ago

fixes to DData plotting for mustrain/size

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Author Revision URL Id
File size: 42.2 KB
Line 
1# -*- coding: utf-8 -*-
2#GSASII - phase data display routines
3########### SVN repository information ###################
4# $Date: 2015-03-17 20:32:23 +0000 (Tue, 17 Mar 2015) $
5# $Author: vondreele $
6# $Revision: 1731 $
7# $URL: trunk/GSASIIddataGUI.py $
8# $Id: GSASIIddataGUI.py 1731 2015-03-17 20:32:23Z vondreele $
9########### SVN repository information ###################
10'''
11*GSASIIddataGUI: Phase Diffraction Data GUI*
12--------------------------------------------
13
14Module to create the GUI for display of diffraction data * phase
15information that is shown in the data display window
16(when a phase is selected.)
17
18'''
19import wx
20import math
21import copy
22import time
23import sys
24import GSASIIpath
25GSASIIpath.SetVersionNumber("$Revision: 1731 $")
26import GSASIIlattice as G2lat
27import GSASIIspc as G2spc
28import GSASIIElem as G2elem
29import GSASIIElemGUI as G2elemGUI
30import GSASIIplot as G2plt
31import GSASIIgrid as G2gd
32import GSASIIIO as G2IO
33import GSASIImath as G2mth
34import GSASIIpwd as G2pwd
35import GSASIIphsGUI as G2phsGUI
36import numpy as np
37
38WACV = wx.ALIGN_CENTER_VERTICAL
39VERY_LIGHT_GREY = wx.Colour(235,235,235)
40WHITE = wx.Colour(255,255,255)
41BLACK = wx.Colour(0,0,0)
42mapDefault = {'MapType':'','RefList':'','Resolution':0.5,'Show bonds':True,
43                'rho':[],'rhoMax':0.,'mapSize':10.0,'cutOff':50.,'Flip':False}
44
45################################################################################
46##### DData routines
47################################################################################       
48def UpdateDData(G2frame,DData,data,hist=''):
49    '''Display the Diffraction Data associated with a phase
50    (items where there is a value for each histogram and phase)
51
52    :param wx.frame G2frame: the main GSAS-II frame object
53
54    :param wx.ScrolledWindow DData: notebook page to be used for the display
55
56    :param dict data: all the information on the phase in a dictionary
57
58    '''
59    G2frame.dataFrame.SetStatusText('')
60    UseList = data['Histograms']
61    if UseList:
62        G2frame.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,True)
63        for item in G2frame.Refine: item.Enable(True)
64    else:
65        G2frame.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,False)
66        for item in G2frame.Refine: item.Enable(False)
67    generalData = data['General']
68    PhaseName = generalData['Name']       
69    SGData = generalData['SGData']
70    keyList = UseList.keys()
71    keyList.sort()
72    if not hist and len(keyList):
73        hist = keyList[0]
74    PWDR = any(['PWDR' in item for item in keyList])
75    Indx = {}
76   
77    def PlotSizer():
78
79        def OnPlotSel(event):
80            Obj = event.GetEventObject()
81            generalData['Data plot type'] = Obj.GetStringSelection()
82            G2plt.PlotSizeStrainPO(G2frame,data,hist)
83            wx.CallLater(100,UpdateDData,G2frame,DData,data)
84           
85        def OnPOhkl(event):
86            Obj = event.GetEventObject()
87            Saxis = Obj.GetValue().split()
88            try:
89                hkl = [int(Saxis[i]) for i in range(3)]
90            except (ValueError,IndexError):
91                hkl = generalData['POhkl']
92            if not np.any(np.array(hkl)):
93                hkl = generalData['POhkl']
94            generalData['POhkl'] = hkl
95            h,k,l = hkl
96            Obj.SetValue('%3d %3d %3d'%(h,k,l)) 
97            G2plt.PlotSizeStrainPO(G2frame,data,hist)
98       
99        plotSizer = wx.BoxSizer(wx.VERTICAL)
100        choice = ['None','Mustrain','Size','Preferred orientation']
101        plotSel = wx.RadioBox(DData,-1,'Select plot type:',choices=choice,
102            majorDimension=1,style=wx.RA_SPECIFY_COLS)
103        plotSel.SetStringSelection(generalData['Data plot type'])
104        plotSel.Bind(wx.EVT_RADIOBOX,OnPlotSel)   
105        plotSizer.Add(plotSel)
106        if generalData['Data plot type'] == 'Preferred orientation':
107            POhklSizer = wx.BoxSizer(wx.HORIZONTAL)
108            POhklSizer.Add(wx.StaticText(DData,-1,' Plot preferred orientation for H K L: '),0,WACV)
109            h,k,l = generalData['POhkl']
110            poAxis = wx.TextCtrl(DData,-1,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER)
111            poAxis.Bind(wx.EVT_TEXT_ENTER,OnPOhkl)
112            poAxis.Bind(wx.EVT_KILL_FOCUS,OnPOhkl)
113            POhklSizer.Add(poAxis,0,WACV)
114            plotSizer.Add(POhklSizer)           
115        return plotSizer
116       
117    def ScaleSizer():
118       
119        def OnScaleRef(event):
120            Obj = event.GetEventObject()
121            UseList[Indx[Obj.GetId()]]['Scale'][1] = Obj.GetValue()
122           
123        def OnScaleVal(event):
124            Obj = event.GetEventObject()
125            try:
126                scale = float(Obj.GetValue())
127                if scale > 0:
128                    UseList[Indx[Obj.GetId()]]['Scale'][0] = scale
129            except ValueError:
130                pass
131            Obj.SetValue("%.4f"%(UseList[Indx[Obj.GetId()]]['Scale'][0]))          #reset in case of error
132                       
133        scaleSizer = wx.BoxSizer(wx.HORIZONTAL)
134        if 'PWDR' in hist:
135            scaleRef = wx.CheckBox(DData,-1,label=' Phase fraction: ')
136        elif 'HKLF' in hist:
137            scaleRef = wx.CheckBox(DData,-1,label=' Scale factor: ')               
138        scaleRef.SetValue(UseList[hist]['Scale'][1])
139        Indx[scaleRef.GetId()] = hist
140        scaleRef.Bind(wx.EVT_CHECKBOX, OnScaleRef)
141        scaleSizer.Add(scaleRef,0,WACV)
142        scaleVal = wx.TextCtrl(DData,wx.ID_ANY,
143            '%.4f'%(UseList[hist]['Scale'][0]),style=wx.TE_PROCESS_ENTER)
144        Indx[scaleVal.GetId()] = hist
145        scaleVal.Bind(wx.EVT_TEXT_ENTER,OnScaleVal)
146        scaleVal.Bind(wx.EVT_KILL_FOCUS,OnScaleVal)
147        scaleSizer.Add(scaleVal,0,WACV)
148        return scaleSizer
149       
150    def OnUseData(event):
151        Obj = event.GetEventObject()
152        hist = Indx[Obj.GetId()]
153        UseList[hist]['Use'] = Obj.GetValue()
154       
155    def OnCopyData(event):
156        Obj = event.GetEventObject()
157        hist = Indx[Obj.GetId()]
158        sourceDict = UseList[hist]
159        if 'HKLF' in sourceDict['Histogram']:
160            copyNames = ['Scale','Extinction','Babinet']
161        else:  #PWDR 
162            copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet']
163        copyDict = {}
164        for name in copyNames: 
165            copyDict[name] = copy.deepcopy(sourceDict[name])        #force copy
166        keyList = sorted(UseList.keys())
167        if UseList:
168            dlg = G2gd.G2MultiChoiceDialog(G2frame.dataFrame, 'Copy parameters', 
169                'Copy parameters to which histograms?', 
170                keyList)
171            try:
172                if dlg.ShowModal() == wx.ID_OK:
173                    for sel in dlg.GetSelections():
174                        UseList[keyList[sel]].update(copy.deepcopy(copyDict))
175                    wx.CallLater(100,UpdateDData,G2frame,DData,data)
176            finally:
177                dlg.Destroy()
178               
179    def OnCopyFlags(event):
180        Obj = event.GetEventObject()
181        hist = Indx[Obj.GetId()]
182        sourceDict = UseList[hist]
183        copyDict = {}
184        if 'HKLF' in sourceDict['Histogram']:
185            copyNames = ['Scale','Extinction','Babinet']
186        else:  #PWDR 
187            copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet']
188        babNames = ['BabA','BabU']
189        for name in copyNames:
190            if name in ['Scale','Extinction','HStrain']:
191                if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']:
192                    copyDict[name] = {name:[sourceDict[name][:2]]}
193                    for item in ['Eg','Es','Ep']:
194                        copyDict[name][item] = sourceDict[name][2][item][1]
195                else:
196                    copyDict[name] = sourceDict[name][1]
197            elif name in ['Size','Mustrain']:
198                copyDict[name] = [sourceDict[name][0],sourceDict[name][2],sourceDict[name][4]]
199            elif name == 'Pref.Ori.':
200                copyDict[name] = [sourceDict[name][0],sourceDict[name][2]]
201                if sourceDict[name][0] == 'SH':
202                    SHterms = sourceDict[name][5]
203                    SHflags = {}
204                    for item in SHterms:
205                        SHflags[item] = SHterms[item][1]
206                    copyDict[name].append(SHflags)
207            elif name == 'Babinet':
208                copyDict[name] = {}
209                for bab in babNames:
210                    copyDict[name][bab] = sourceDict[name][bab][1]                       
211        keyList = sorted(UseList.keys())
212        if UseList:
213            dlg = G2gd.G2MultiChoiceDialog(G2frame.dataFrame, 'Copy parameters', 
214                'Copy parameters to which histograms?', 
215                keyList)
216            try:
217                if dlg.ShowModal() == wx.ID_OK:
218                    for sel in dlg.GetSelections():
219                        item = keyList[sel]
220                        UseList[item]
221                        for name in copyNames:
222                            if name in ['Scale','Extinction','HStrain']:
223                                if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']:
224                                    UseList[item][name][:2] = copy.deepcopy(sourceDict[name][:2])
225                                    for itm in ['Eg','Es','Ep']:
226                                        UseList[item][name][2][itm][1] = copy.deepcopy(copyDict[name][itm])
227                                else:
228                                    UseList[item][name][1] = copy.deepcopy(copyDict[name])
229                            elif name in ['Size','Mustrain']:
230                                UseList[item][name][0] = copy.deepcopy(copyDict[name][0])
231                                UseList[item][name][2] = copy.deepcopy(copyDict[name][1])
232                                UseList[item][name][4] = copy.deepcopy(copyDict[name][2])
233                            elif name == 'Pref.Ori.':
234                                UseList[item][name][0] = copy.deepcopy(copyDict[name][0])
235                                UseList[item][name][2] = copy.deepcopy(copyDict[name][1])
236                                if sourceDict[name][0] == 'SH':
237                                    SHflags = copy.deepcopy(copyDict[name][2])
238                                    SHterms = copy.deepcopy(sourceDict[name][5])
239                                    for item in SHflags:
240                                        SHterms[item][1] = copy.deepcopy(SHflags[item])
241                            elif name == 'Babinet':
242                                for bab in babNames:
243                                    UseList[item][name][bab][1] = copy.deepcopy(copyDict[name][bab])                                             
244                    wx.CallLater(100,UpdateDData,G2frame,DData,data)
245            finally:
246                dlg.Destroy()
247               
248    def OnLGmixRef(event):
249        Obj = event.GetEventObject()
250        hist,name = Indx[Obj.GetId()]
251        UseList[hist][name][2][2] = Obj.GetValue()
252       
253    def OnLGmixVal(event):
254        Obj = event.GetEventObject()
255        hist,name = Indx[Obj.GetId()]
256        try:
257            value = float(Obj.GetValue())
258            if 0 <= value <= 1:
259                UseList[hist][name][1][2] = value
260            else:
261                raise ValueError
262        except ValueError:
263            pass
264        Obj.SetValue("%.4f"%(UseList[hist][name][1][2]))          #reset in case of error
265
266    def OnSizeType(event):
267        Obj = event.GetEventObject()
268        hist = Indx[Obj.GetId()]
269        UseList[hist]['Size'][0] = Obj.GetValue()
270        G2plt.PlotSizeStrainPO(G2frame,data,hist)
271        wx.CallLater(100,UpdateDData,G2frame,DData,data)
272       
273    def OnSizeRef(event):
274        Obj = event.GetEventObject()
275        hist,pid = Indx[Obj.GetId()]
276        if UseList[hist]['Size'][0] == 'ellipsoidal':
277            UseList[hist]['Size'][5][pid] = Obj.GetValue()               
278        else:
279            UseList[hist]['Size'][2][pid] = Obj.GetValue()
280       
281    def OnSizeVal(event):
282        Obj = event.GetEventObject()
283        hist,pid = Indx[Obj.GetId()]
284        if UseList[hist]['Size'][0] == 'ellipsoidal':
285            try:
286                size = float(Obj.GetValue())
287                if pid < 3 and size <= 0.001:            #10A lower limit!
288                    raise ValueError
289                UseList[hist]['Size'][4][pid] = size                   
290            except ValueError:
291                pass
292            Obj.SetValue("%.5f"%(UseList[hist]['Size'][4][pid]))          #reset in case of error
293        else:
294            try:
295                size = float(Obj.GetValue())
296                if size <= 0.001:            #10A lower limit!
297                    raise ValueError
298                UseList[hist]['Size'][1][pid] = size
299            except ValueError:
300                pass
301            Obj.SetValue("%.5f"%(UseList[hist]['Size'][1][pid]))          #reset in case of error
302        G2plt.PlotSizeStrainPO(G2frame,data,hist)
303       
304    def OnSizeAxis(event):           
305        Obj = event.GetEventObject()
306        hist = Indx[Obj.GetId()]
307        Saxis = Obj.GetValue().split()
308        try:
309            hkl = [int(Saxis[i]) for i in range(3)]
310        except (ValueError,IndexError):
311            hkl = UseList[hist]['Size'][3]
312        if not np.any(np.array(hkl)):
313            hkl = UseList[hist]['Size'][3]
314        UseList[hist]['Size'][3] = hkl
315        h,k,l = hkl
316        Obj.SetValue('%3d %3d %3d'%(h,k,l)) 
317                   
318    def OnResetSize(event):
319        Obj = event.GetEventObject()
320        Obj.SetValue(False)
321        item,name = Indx[Obj.GetId()]
322        if name == 'isotropic':
323            UseList[item]['Size'][1][0] = 1.0
324        elif name == 'uniaxial':
325            UseList[item]['Size'][1][0] = 1.0
326            UseList[item]['Size'][1][1] = 1.0
327        elif name == 'ellipsoidal':
328            for i in range(3):
329                UseList[item]['Size'][4][i] = 1.0
330                UseList[item]['Size'][4][i+3] = 0.0
331        G2plt.PlotSizeStrainPO(G2frame,data,item)
332        wx.CallLater(100,UpdateDData,G2frame,DData,data)
333           
334    def OnStrainType(event):
335        Obj = event.GetEventObject()
336        hist = Indx[Obj.GetId()]
337        UseList[hist]['Mustrain'][0] = Obj.GetValue()
338        wx.CallLater(100,UpdateDData,G2frame,DData,data)
339        G2plt.PlotSizeStrainPO(G2frame,data,hist)
340       
341    def OnStrainRef(event):
342        Obj = event.GetEventObject()
343        hist,pid = Indx[Obj.GetId()]
344        if UseList[hist]['Mustrain'][0] == 'generalized':
345            UseList[hist]['Mustrain'][5][pid] = Obj.GetValue()
346        else:
347            UseList[hist]['Mustrain'][2][pid] = Obj.GetValue()
348       
349    def OnStrainVal(event):
350        Snames = G2spc.MustrainNames(SGData)
351        Obj = event.GetEventObject()
352        hist,pid = Indx[Obj.GetId()]
353        try:
354            strain = float(Obj.GetValue())
355            if UseList[hist]['Mustrain'][0] == 'generalized':
356                if '4' in Snames[pid] and strain < 0:
357                    raise ValueError
358                UseList[hist]['Mustrain'][4][pid] = strain
359            else:
360                if strain <= 0:
361                    raise ValueError
362                UseList[hist]['Mustrain'][1][pid] = strain
363        except ValueError:
364            pass
365        if UseList[hist]['Mustrain'][0] == 'generalized':
366            Obj.SetValue("%.3f"%(UseList[hist]['Mustrain'][4][pid]))          #reset in case of error
367        else:
368            Obj.SetValue("%.1f"%(UseList[hist]['Mustrain'][1][pid]))          #reset in case of error
369        G2plt.PlotSizeStrainPO(G2frame,data,hist)
370       
371    def OnStrainAxis(event):
372        Obj = event.GetEventObject()
373        hist = Indx[Obj.GetId()]
374        Saxis = Obj.GetValue().split()
375        try:
376            hkl = [int(Saxis[i]) for i in range(3)]
377        except (ValueError,IndexError):
378            hkl = UseList[hist]['Mustrain'][3]
379        if not np.any(np.array(hkl)):
380            hkl = UseList[hist]['Mustrain'][3]
381        UseList[hist]['Mustrain'][3] = hkl
382        h,k,l = hkl
383        Obj.SetValue('%3d %3d %3d'%(h,k,l)) 
384        G2plt.PlotSizeStrainPO(G2frame,data,hist)
385       
386    def OnResetStrain(event):
387        Obj = event.GetEventObject()
388        Obj.SetValue(False)
389        item,name = Indx[Obj.GetId()]
390        if name == 'isotropic':
391            UseList[item]['Mustrain'][1][0] = 1000.0
392        elif name == 'uniaxial':
393            UseList[item]['Mustrain'][1][0] = 1000.0
394            UseList[item]['Mustrain'][1][1] = 1000.0
395        elif name == 'generalized':
396            muiso = 1000.
397            cell = generalData['Cell'][1:7]
398            vals = G2spc.Muiso2Shkl(muiso,SGData,cell)
399            nTerm = len(UseList[item]['Mustrain'][4])
400            for i in range(nTerm):
401                UseList[item]['Mustrain'][4][i] = vals[i]
402        G2plt.PlotSizeStrainPO(G2frame,data,item)
403        wx.CallLater(100,UpdateDData,G2frame,DData,data)
404           
405    def OnHstrainRef(event):
406        Obj = event.GetEventObject()
407        hist,pid = Indx[Obj.GetId()]
408        UseList[hist]['HStrain'][1][pid] = Obj.GetValue()
409       
410    def OnHstrainVal(event):
411        Snames = G2spc.HStrainNames(SGData)
412        Obj = event.GetEventObject()
413        hist,pid = Indx[Obj.GetId()]
414        try:
415            strain = float(Obj.GetValue())
416            UseList[hist]['HStrain'][0][pid] = strain
417        except ValueError:
418            pass
419        Obj.SetValue("%.3g"%(UseList[hist]['HStrain'][0][pid]))          #reset in case of error
420
421    def OnPOVal(event):
422        Obj = event.GetEventObject()
423        hist = Indx[Obj.GetId()]
424        try:
425            mdVal = float(Obj.GetValue())
426            if mdVal > 0:
427                UseList[hist]['Pref.Ori.'][1] = mdVal
428        except ValueError:
429            pass
430        Obj.SetValue("%.3f"%(UseList[hist]['Pref.Ori.'][1]))          #reset in case of error
431       
432    def OnPOAxis(event):
433        Obj = event.GetEventObject()
434        hist = Indx[Obj.GetId()]
435        Saxis = Obj.GetValue().split()
436        try:
437            hkl = [int(Saxis[i]) for i in range(3)]
438        except (ValueError,IndexError):
439            hkl = UseList[hist]['Pref.Ori.'][3]
440        if not np.any(np.array(hkl)):
441            hkl = UseList[hist]['Pref.Ori.'][3]
442        UseList[hist]['Pref.Ori.'][3] = hkl
443        h,k,l = hkl
444        Obj.SetValue('%3d %3d %3d'%(h,k,l)) 
445       
446    def OnPOOrder(event):
447        Obj = event.GetEventObject()
448        hist = Indx[Obj.GetId()]
449        Order = int(Obj.GetValue())
450        UseList[hist]['Pref.Ori.'][4] = Order
451        UseList[hist]['Pref.Ori.'][5] = SetPOCoef(Order,hist)
452        wx.CallLater(100,UpdateDData,G2frame,DData,data)
453
454    def OnPOType(event):
455        Obj = event.GetEventObject()
456        hist = Indx[Obj.GetId()]
457        if 'March' in Obj.GetValue():
458            UseList[hist]['Pref.Ori.'][0] = 'MD'
459        else:
460            UseList[hist]['Pref.Ori.'][0] = 'SH'
461        wx.CallLater(100,UpdateDData,G2frame,DData,data)
462
463    def OnPORef(event):
464        Obj = event.GetEventObject()
465        hist = Indx[Obj.GetId()]
466        UseList[hist]['Pref.Ori.'][2] = Obj.GetValue()
467           
468    def SetPOCoef(Order,hist):
469        cofNames = G2lat.GenSHCoeff(SGData['SGLaue'],'0',Order,False)     #cylindrical & no M
470        newPOCoef = dict(zip(cofNames,np.zeros(len(cofNames))))
471        POCoeff = UseList[hist]['Pref.Ori.'][5]
472        for cofName in POCoeff:
473            if cofName in  cofNames:
474                newPOCoef[cofName] = POCoeff[cofName]
475        return newPOCoef
476   
477    def OnExtRef(event):
478        Obj = event.GetEventObject()
479        UseList[Indx[Obj.GetId()]]['Extinction'][1] = Obj.GetValue()
480       
481    def OnExtVal(event):
482        Obj = event.GetEventObject()
483        try:
484            ext = float(Obj.GetValue())
485            if ext >= 0:
486                UseList[Indx[Obj.GetId()]]['Extinction'][0] = ext
487        except ValueError:
488            pass
489        Obj.SetValue("%.2f"%(UseList[Indx[Obj.GetId()]]['Extinction'][0]))
490
491    def OnBabRef(event):
492        Obj = event.GetEventObject()
493        item,bab = Indx[Obj.GetId()]
494        UseList[item]['Babinet']['Bab'+bab][1] = Obj.GetValue()
495       
496    def OnBabVal(event):
497        Obj = event.GetEventObject()
498        item,bab = Indx[Obj.GetId()]
499        try:
500            val = float(Obj.GetValue())
501            if val >= 0:
502                UseList[item]['Babinet']['Bab'+bab][0] = val
503        except ValueError:
504            pass
505        Obj.SetValue("%.3f"%(UseList[item]['Babinet']['Bab'+bab][0]))
506
507    def OnTbarVal(event):
508        Obj = event.GetEventObject()
509        try:
510            tbar = float(Obj.GetValue())
511            if tbar > 0:
512                UseList[Indx[Obj.GetId()]]['Extinction'][2]['Tbar'] = tbar
513        except ValueError:
514            pass
515        Obj.SetValue("%.3f"%(UseList[Indx[Obj.GetId()]]['Extinction'][2]['Tbar']))
516
517    def OnCos2TM(event):
518        Obj = event.GetEventObject()
519        try:
520            val = float(Obj.GetValue())
521            if 0. < val <= 1.:
522                UseList[Indx[Obj.GetId()]]['Extinction'][2]['Cos2TM'] = val
523        except ValueError:
524            pass
525        Obj.SetValue("%.3f"%(UseList[Indx[Obj.GetId()]]['Extinction'][2]['Cos2TM']))
526       
527    def OnEval(event):
528        Obj = event.GetEventObject()
529        item = Indx[Obj.GetId()]
530        try:
531            val = float(Obj.GetValue())
532            if val > 0:
533                UseList[item[0]]['Extinction'][2][item[1]][0] = val
534        except ValueError:
535            pass
536        Obj.SetValue("%10.3e"%(UseList[item[0]]['Extinction'][2][item[1]][0]))
537       
538    def OnEref(event):
539        Obj = event.GetEventObject()
540        item = Indx[Obj.GetId()]
541        UseList[item[0]]['Extinction'][2][item[1]][1] = Obj.GetValue()
542
543    def OnSCExtType(event):
544        Obj = event.GetEventObject()
545        item = Indx[Obj.GetId()]
546        UseList[item[0]]['Extinction'][item[1]] = Obj.GetValue()
547        wx.CallLater(100,UpdateDData,G2frame,DData,data)
548           
549    def checkAxis(axis):
550        if not np.any(np.array(axis)):
551            return False
552        return axis
553       
554    def TopSizer(name,choices,parm,OnType):
555        topSizer = wx.BoxSizer(wx.HORIZONTAL)
556        topSizer.Add(wx.StaticText(DData,-1,name),0,WACV)
557        sizeType = wx.ComboBox(DData,wx.ID_ANY,value=UseList[hist][parm][0],choices=choices,
558            style=wx.CB_READONLY|wx.CB_DROPDOWN)
559        sizeType.Bind(wx.EVT_COMBOBOX, OnType)
560        Indx[sizeType.GetId()] = hist
561        topSizer.Add(sizeType)
562        topSizer.Add((5,0),0)
563        return topSizer
564       
565    def LGmixSizer(name,OnVal,OnRef):
566        lgmixSizer = wx.BoxSizer(wx.HORIZONTAL)
567        lgmixRef = wx.CheckBox(DData,-1,label='LGmix')
568        lgmixRef.thisown = False
569        lgmixRef.SetValue(UseList[hist][name][2][2])
570        Indx[lgmixRef.GetId()] = [hist,name]
571        lgmixRef.Bind(wx.EVT_CHECKBOX, OnRef)
572        lgmixSizer.Add(lgmixRef,0,WACV)
573        lgmixVal = wx.TextCtrl(DData,wx.ID_ANY,
574            '%.4f'%(UseList[hist][name][1][2]),style=wx.TE_PROCESS_ENTER)
575        Indx[lgmixVal.GetId()] = [hist,name]
576        lgmixVal.Bind(wx.EVT_TEXT_ENTER,OnVal)
577        lgmixVal.Bind(wx.EVT_KILL_FOCUS,OnVal)
578        lgmixSizer.Add(lgmixVal,0,WACV)
579        return lgmixSizer
580                   
581    def ResetSizer(name,OnReset):
582        resetSizer = wx.BoxSizer(wx.HORIZONTAL)
583        resetSizer.Add((5,0),0)
584        reset = wx.CheckBox(DData,-1,label='Reset?')
585        reset.thisown = False
586        reset.SetValue(False)
587        Indx[reset.GetId()] = [hist,name]
588        reset.Bind(wx.EVT_CHECKBOX,OnReset)
589        resetSizer.Add(reset,0,WACV)
590        return resetSizer
591       
592    def IsoSizer(name,parm,fmt,OnVal,OnRef):
593        isoSizer = wx.BoxSizer(wx.HORIZONTAL)
594        sizeRef = wx.CheckBox(DData,-1,label=name)
595        sizeRef.thisown = False
596        sizeRef.SetValue(UseList[hist][parm][2][0])
597        Indx[sizeRef.GetId()] = [hist,0]
598        sizeRef.Bind(wx.EVT_CHECKBOX, OnRef)
599        isoSizer.Add(sizeRef,0,WACV)
600        sizeVal = wx.TextCtrl(DData,wx.ID_ANY,
601            fmt%(UseList[hist][parm][1][0]),style=wx.TE_PROCESS_ENTER)
602        Indx[sizeVal.GetId()] = [hist,0]
603        sizeVal.Bind(wx.EVT_TEXT_ENTER,OnVal)
604        sizeVal.Bind(wx.EVT_KILL_FOCUS,OnVal)
605        isoSizer.Add(sizeVal,0,WACV)
606        return isoSizer
607       
608    def UniSizer(parm,OnAxis):
609        uniSizer = wx.BoxSizer(wx.HORIZONTAL)
610        uniSizer.Add(wx.StaticText(DData,-1,' Unique axis, H K L: '),0,WACV)
611        h,k,l = UseList[hist][parm][3]
612        Axis = wx.TextCtrl(DData,-1,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER)
613        Indx[Axis.GetId()] = hist
614        Axis.Bind(wx.EVT_TEXT_ENTER,OnAxis)
615        Axis.Bind(wx.EVT_KILL_FOCUS,OnAxis)
616        uniSizer.Add(Axis,0,WACV)
617        return uniSizer
618       
619    def UniDataSizer(parmName,parm,fmt,OnVal,OnRef):
620        dataSizer = wx.BoxSizer(wx.HORIZONTAL)
621        parms = zip([' Equatorial '+parmName,' Axial '+parmName],
622            UseList[hist][parm][1],UseList[hist][parm][2],range(2))
623        for Pa,val,ref,id in parms:
624            sizeRef = wx.CheckBox(DData,-1,label=Pa)
625            sizeRef.thisown = False
626            sizeRef.SetValue(ref)
627            Indx[sizeRef.GetId()] = [hist,id]
628            sizeRef.Bind(wx.EVT_CHECKBOX, OnRef)
629            dataSizer.Add(sizeRef,0,WACV)
630            sizeVal = wx.TextCtrl(DData,wx.ID_ANY,fmt%(val),style=wx.TE_PROCESS_ENTER)
631            Indx[sizeVal.GetId()] = [hist,id]
632            sizeVal.Bind(wx.EVT_TEXT_ENTER,OnVal)
633            sizeVal.Bind(wx.EVT_KILL_FOCUS,OnVal)
634            dataSizer.Add(sizeVal,0,WACV)
635            dataSizer.Add((5,0),0)
636        return dataSizer
637       
638    def EllSizeDataSizer():
639        parms = zip(['S11','S22','S33','S12','S13','S23'],UseList[hist]['Size'][4],
640            UseList[hist]['Size'][5],range(6))
641        dataSizer = wx.FlexGridSizer(0,6,5,5)
642        for Pa,val,ref,id in parms:
643            sizeRef = wx.CheckBox(DData,-1,label=Pa)
644            sizeRef.thisown = False
645            sizeRef.SetValue(ref)
646            Indx[sizeRef.GetId()] = [hist,id]
647            sizeRef.Bind(wx.EVT_CHECKBOX, OnSizeRef)
648            dataSizer.Add(sizeRef,0,WACV)
649            sizeVal = wx.TextCtrl(DData,wx.ID_ANY,'%.3f'%(val),style=wx.TE_PROCESS_ENTER)
650            Indx[sizeVal.GetId()] = [hist,id]
651            sizeVal.Bind(wx.EVT_TEXT_ENTER,OnSizeVal)
652            sizeVal.Bind(wx.EVT_KILL_FOCUS,OnSizeVal)
653            dataSizer.Add(sizeVal,0,WACV)
654        return dataSizer
655       
656    def GenStrainDataSizer():
657        Snames = G2spc.MustrainNames(SGData)
658        numb = len(Snames)
659        if len(UseList[hist]['Mustrain'][4]) < numb:
660            UseList[hist]['Mustrain'][4] = numb*[0.0,]
661            UseList[hist]['Mustrain'][5] = numb*[False,]
662        parms = zip(Snames,UseList[hist]['Mustrain'][4],UseList[hist]['Mustrain'][5],range(numb))
663        dataSizer = wx.FlexGridSizer(0,6,5,5)
664        for Pa,val,ref,id in parms:
665            strainRef = wx.CheckBox(DData,-1,label=Pa)
666            strainRef.thisown = False
667            strainRef.SetValue(ref)
668            Indx[strainRef.GetId()] = [hist,id]
669            strainRef.Bind(wx.EVT_CHECKBOX, OnStrainRef)
670            dataSizer.Add(strainRef,0,WACV)
671            strainVal = wx.TextCtrl(DData,wx.ID_ANY,'%.5f'%(val),style=wx.TE_PROCESS_ENTER)
672            Indx[strainVal.GetId()] = [hist,id]
673            strainVal.Bind(wx.EVT_TEXT_ENTER,OnStrainVal)
674            strainVal.Bind(wx.EVT_KILL_FOCUS,OnStrainVal)
675            dataSizer.Add(strainVal,0,WACV)
676        return dataSizer
677
678    def HstrainSizer():
679        hstrainSizer = wx.FlexGridSizer(0,6,5,5)
680        Hsnames = G2spc.HStrainNames(SGData)
681        parms = zip(Hsnames,UseList[hist]['HStrain'][0],UseList[hist]['HStrain'][1],range(len(Hsnames)))
682        for Pa,val,ref,id in parms:
683            hstrainRef = wx.CheckBox(DData,-1,label=Pa)
684            hstrainRef.thisown = False
685            hstrainRef.SetValue(ref)
686            Indx[hstrainRef.GetId()] = [hist,id]
687            hstrainRef.Bind(wx.EVT_CHECKBOX, OnHstrainRef)
688            hstrainSizer.Add(hstrainRef,0,WACV)
689            hstrainVal = wx.TextCtrl(DData,wx.ID_ANY,'%.3g'%(val),style=wx.TE_PROCESS_ENTER)
690            Indx[hstrainVal.GetId()] = [hist,id]
691            hstrainVal.Bind(wx.EVT_TEXT_ENTER,OnHstrainVal)
692            hstrainVal.Bind(wx.EVT_KILL_FOCUS,OnHstrainVal)
693            hstrainSizer.Add(hstrainVal,0,WACV)
694        return hstrainSizer
695       
696    def PoTopSizer(POData):
697        poSizer = wx.FlexGridSizer(0,6,5,5)
698        choice = ['March-Dollase','Spherical harmonics']
699        POtype = choice[['MD','SH'].index(POData[0])]
700        poSizer.Add(wx.StaticText(DData,-1,' Preferred orientation model '),0,WACV)
701        POType = wx.ComboBox(DData,wx.ID_ANY,value=POtype,choices=choice,
702            style=wx.CB_READONLY|wx.CB_DROPDOWN)
703        Indx[POType.GetId()] = hist
704        POType.Bind(wx.EVT_COMBOBOX, OnPOType)
705        poSizer.Add(POType)
706        if POData[0] == 'SH':
707            poSizer.Add(wx.StaticText(DData,-1,' Harmonic order: '),0,WACV)
708            poOrder = wx.ComboBox(DData,wx.ID_ANY,value=str(POData[4]),choices=[str(2*i) for i in range(18)],
709                style=wx.CB_READONLY|wx.CB_DROPDOWN)
710            Indx[poOrder.GetId()] = hist
711            poOrder.Bind(wx.EVT_COMBOBOX,OnPOOrder)
712            poSizer.Add(poOrder,0,WACV)
713            poRef = wx.CheckBox(DData,-1,label=' Refine? ')
714            poRef.SetValue(POData[2])
715            Indx[poRef.GetId()] = hist
716            poRef.Bind(wx.EVT_CHECKBOX,OnPORef)
717            poSizer.Add(poRef,0,WACV)
718        return poSizer
719       
720    def MDDataSizer(POData):
721        poSizer = wx.BoxSizer(wx.HORIZONTAL)
722        poRef = wx.CheckBox(DData,-1,label=' March-Dollase ratio: ')
723        poRef.SetValue(POData[2])
724        Indx[poRef.GetId()] = hist
725        poRef.Bind(wx.EVT_CHECKBOX,OnPORef)
726        poSizer.Add(poRef,0,WACV)
727        poVal = wx.TextCtrl(DData,wx.ID_ANY,
728            '%.3f'%(POData[1]),style=wx.TE_PROCESS_ENTER)
729        Indx[poVal.GetId()] = hist
730        poVal.Bind(wx.EVT_TEXT_ENTER,OnPOVal)
731        poVal.Bind(wx.EVT_KILL_FOCUS,OnPOVal)
732        poSizer.Add(poVal,0,WACV)
733        poSizer.Add(wx.StaticText(DData,-1,' Unique axis, H K L: '),0,WACV)
734        h,k,l =POData[3]
735        poAxis = wx.TextCtrl(DData,-1,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER)
736        Indx[poAxis.GetId()] = hist
737        poAxis.Bind(wx.EVT_TEXT_ENTER,OnPOAxis)
738        poAxis.Bind(wx.EVT_KILL_FOCUS,OnPOAxis)
739        poSizer.Add(poAxis,0,WACV)
740        return poSizer
741       
742    def SHDataSizer(POData):
743        textJ = G2lat.textureIndex(POData[5])
744        mainSizer.Add(wx.StaticText(DData,-1,' Spherical harmonic coefficients: '+'Texture index: %.3f'%(textJ)),0,WACV)
745        mainSizer.Add((0,5),0)
746        ODFSizer = wx.FlexGridSizer(0,8,2,2)
747        ODFIndx = {}
748        ODFkeys = POData[5].keys()
749        ODFkeys.sort()
750        for odf in ODFkeys:
751            ODFSizer.Add(wx.StaticText(DData,-1,odf),0,WACV)
752            ODFval = wx.TextCtrl(DData,wx.ID_ANY,'%8.3f'%(POData[5][odf]),style=wx.TE_PROCESS_ENTER)
753            ODFIndx[ODFval.GetId()] = odf
754#             ODFval.Bind(wx.EVT_TEXT_ENTER,OnODFValue)
755#             ODFval.Bind(wx.EVT_KILL_FOCUS,OnODFValue)
756            ODFSizer.Add(ODFval,0,WACV)
757        return ODFSizer
758       
759    def ExtSizer():           
760        extSizer = wx.BoxSizer(wx.HORIZONTAL)
761        extRef = wx.CheckBox(DData,-1,label=' Extinction: ')
762        extRef.SetValue(UseList[hist]['Extinction'][1])
763        Indx[extRef.GetId()] = hist
764        extRef.Bind(wx.EVT_CHECKBOX, OnExtRef)
765        extSizer.Add(extRef,0,WACV)
766        extVal = wx.TextCtrl(DData,wx.ID_ANY,
767            '%.2f'%(UseList[hist]['Extinction'][0]),style=wx.TE_PROCESS_ENTER)
768        Indx[extVal.GetId()] = hist
769        extVal.Bind(wx.EVT_TEXT_ENTER,OnExtVal)
770        extVal.Bind(wx.EVT_KILL_FOCUS,OnExtVal)
771        extSizer.Add(extVal,0,WACV)
772        return extSizer
773   
774    def SCExtSizer():
775        extSizer = wx.BoxSizer(wx.VERTICAL)
776        typeSizer = wx.BoxSizer(wx.HORIZONTAL)           
777        typeSizer.Add(wx.StaticText(DData,-1,' Extinction type: '),0,WACV)
778        Choices = ['None','Primary','Secondary Type I','Secondary Type II','Secondary Type I & II']
779        typeTxt = wx.ComboBox(DData,-1,choices=Choices,value=UseList[hist]['Extinction'][1],
780            style=wx.CB_READONLY|wx.CB_DROPDOWN)
781        Indx[typeTxt.GetId()] = [hist,1]
782        typeTxt.Bind(wx.EVT_COMBOBOX,OnSCExtType)
783        typeSizer.Add(typeTxt)
784        typeSizer.Add(wx.StaticText(DData,-1,' Approx: '),0,WACV)
785        Choices=['Lorentzian','Gaussian']
786        approxTxT = wx.ComboBox(DData,-1,choices=Choices,value=UseList[hist]['Extinction'][0],
787            style=wx.CB_READONLY|wx.CB_DROPDOWN)
788        Indx[approxTxT.GetId()] = [hist,0]
789        approxTxT.Bind(wx.EVT_COMBOBOX,OnSCExtType)
790        typeSizer.Add(approxTxT)
791        extSizer.Add(typeSizer,0,WACV)
792        if UseList[hist]['Extinction'][1] != 'None':
793            extSizer.Add((0,5),)
794            if 'Tbar' in UseList[hist]['Extinction'][2]:       #skipped for TOF   
795                valSizer =wx.BoxSizer(wx.HORIZONTAL)
796                valSizer.Add(wx.StaticText(DData,-1,' Tbar(mm):'),0,WACV)
797                tbarVal = wx.TextCtrl(DData,wx.ID_ANY,
798                    '%.3f'%(UseList[hist]['Extinction'][2]['Tbar']),style=wx.TE_PROCESS_ENTER)
799                Indx[tbarVal.GetId()] = hist
800                tbarVal.Bind(wx.EVT_TEXT_ENTER,OnTbarVal)
801                tbarVal.Bind(wx.EVT_KILL_FOCUS,OnTbarVal)
802                valSizer.Add(tbarVal,0,WACV)
803                valSizer.Add(wx.StaticText(DData,-1,' cos(2ThM):'),0,WACV)
804                cos2tm = wx.TextCtrl(DData,wx.ID_ANY,
805                    '%.3f'%(UseList[hist]['Extinction'][2]['Cos2TM']),style=wx.TE_PROCESS_ENTER)
806                Indx[cos2tm.GetId()] = hist
807                cos2tm.Bind(wx.EVT_TEXT_ENTER,OnCos2TM)
808                cos2tm.Bind(wx.EVT_KILL_FOCUS,OnCos2TM)
809                valSizer.Add(cos2tm,0,WACV)
810                extSizer.Add(valSizer,0,WACV)
811            val2Sizer =wx.BoxSizer(wx.HORIZONTAL)
812            if 'Primary' in UseList[hist]['Extinction'][1]:
813                Ekey = ['Ep',]
814            elif 'Secondary Type II' == UseList[hist]['Extinction'][1]:
815                Ekey = ['Es',]
816            elif 'Secondary Type I' == UseList[hist]['Extinction'][1]:
817                Ekey = ['Eg',]
818            else:
819                Ekey = ['Eg','Es']
820            for ekey in Ekey:
821                Eref = wx.CheckBox(DData,-1,label=ekey+' : ')
822                Eref.SetValue(UseList[hist]['Extinction'][2][ekey][1])
823                Indx[Eref.GetId()] = [hist,ekey]
824                Eref.Bind(wx.EVT_CHECKBOX, OnEref)
825                val2Sizer.Add(Eref,0,WACV)
826                Eval = wx.TextCtrl(DData,wx.ID_ANY,
827                    '%10.3e'%(UseList[hist]['Extinction'][2][ekey][0]),style=wx.TE_PROCESS_ENTER)
828                Indx[Eval.GetId()] = [hist,ekey]
829                Eval.Bind(wx.EVT_TEXT_ENTER,OnEval)
830                Eval.Bind(wx.EVT_KILL_FOCUS,OnEval)
831                val2Sizer.Add(Eval,0,WACV)
832
833            extSizer.Add(val2Sizer,0,WACV)
834        return extSizer
835       
836    def BabSizer():
837        babSizer = wx.BoxSizer(wx.HORIZONTAL)
838        for bab in ['A','U']:
839            babRef = wx.CheckBox(DData,-1,label=' Babinet '+bab+': ')
840            babRef.SetValue(UseList[hist]['Babinet']['Bab'+bab][1])
841            Indx[babRef.GetId()] = [hist,bab]
842            babRef.Bind(wx.EVT_CHECKBOX, OnBabRef)
843            babSizer.Add(babRef,0,WACV)
844            babVal = wx.TextCtrl(DData,wx.ID_ANY,
845                '%.3f'%(UseList[hist]['Babinet']['Bab'+bab][0]),style=wx.TE_PROCESS_ENTER)
846            Indx[babVal.GetId()] = [hist,bab]
847            babVal.Bind(wx.EVT_TEXT_ENTER,OnBabVal)
848            babVal.Bind(wx.EVT_KILL_FOCUS,OnBabVal)
849            babSizer.Add(babVal,0,WACV)
850            babSizer.Add((5,5),0)
851        return babSizer
852       
853    def OnSelect(event):
854        hist = keyList[select.GetSelection()]
855        G2plt.PlotSizeStrainPO(G2frame,data,hist)
856        wx.CallLater(100,UpdateDData,G2frame,DData,data,hist)
857       
858    def OnSelSpin(event):
859        hist = keyList[selSpin.GetValue()]
860        selSpin.Destroy() # remove button to discourage pressing too fast
861        G2plt.PlotSizeStrainPO(G2frame,data,hist)
862        wx.CallLater(100,UpdateDData,G2frame,DData,data,hist)
863       
864    if DData.GetSizer():
865        DData.GetSizer().Clear(True)
866    mainSizer = wx.BoxSizer(wx.VERTICAL)
867    mainSizer.Add(wx.StaticText(DData,-1,' Histogram data for '+PhaseName+':'),0,WACV)
868    if hist != '':
869        topSizer = wx.FlexGridSizer(1,2,5,5)
870        selSizer = wx.BoxSizer(wx.HORIZONTAL)   
871        selSpin = wx.SpinButton(DData,size=(20,100),style=wx.SP_VERTICAL|wx.SP_WRAP)
872        selSpin.SetValue(keyList.index(hist))
873        selSpin.SetRange(0,len(keyList)-1)
874        selSpin.Bind(wx.EVT_SPIN,OnSelSpin)
875        selSizer.Add(selSpin)
876        select = wx.ListBox(DData,choices=keyList,style=wx.LB_SINGLE,size=(-1,100))
877        select.SetSelection(keyList.index(hist))
878        select.SetFirstItem(keyList.index(hist))
879        select.Bind(wx.EVT_LISTBOX,OnSelect)
880        selSizer.Add(select,0,WACV)
881        topSizer.Add(selSizer)
882        if PWDR:
883            topSizer.Add(PlotSizer())
884        mainSizer.Add(topSizer)       
885           
886        histData = UseList[hist]
887        if 'Use' not in UseList[hist]:      #patch
888            UseList[hist]['Use'] = True
889        if 'Babinet' not in UseList[hist]:
890            UseList[hist]['Babinet'] = {'BabA':[0.0,False],'BabU':[0.0,False]}
891        mainSizer.Add((5,5),0)
892        mainSizer.Add(wx.StaticText(DData,label=' Histogram: '+hist),0,WACV)
893        showSizer = wx.BoxSizer(wx.HORIZONTAL)
894        useData = wx.CheckBox(DData,-1,label='Use?')
895        Indx[useData.GetId()] = hist
896        showSizer.Add(useData,0,WACV)
897        useData.Bind(wx.EVT_CHECKBOX, OnUseData)
898        useData.SetValue(UseList[hist]['Use'])
899        copyData = wx.Button(DData,-1,label=' Copy?')
900        Indx[copyData.GetId()] = hist
901        copyData.Bind(wx.EVT_BUTTON,OnCopyData)
902        showSizer.Add(copyData,WACV)
903        copyFlags = wx.Button(DData,-1,label=' Copy flags?')
904        Indx[copyFlags.GetId()] = hist
905        copyFlags.Bind(wx.EVT_BUTTON,OnCopyFlags)
906        showSizer.Add(copyFlags,WACV)
907        mainSizer.Add((5,5),0)
908        mainSizer.Add(showSizer,0,WACV)
909        mainSizer.Add((0,5),0)
910       
911        mainSizer.Add(ScaleSizer())
912        mainSizer.Add((0,5),0)
913           
914        if hist[:4] == 'PWDR':
915            if UseList[hist]['Size'][0] == 'isotropic':
916                isoSizer = wx.BoxSizer(wx.HORIZONTAL)
917                isoSizer.Add(TopSizer(' Domain size model: ',['isotropic','uniaxial','ellipsoidal'],
918                    'Size',OnSizeType),0,WACV)
919                isoSizer.Add(LGmixSizer('Size',OnLGmixVal,OnLGmixRef))
920                isoSizer.Add(ResetSizer('isotropic',OnResetSize),0,WACV)
921                mainSizer.Add(isoSizer)
922                mainSizer.Add(IsoSizer(u'size(\xb5m): ','Size','%.5f',
923                    OnSizeVal,OnSizeRef),0,WACV)
924            elif UseList[hist]['Size'][0] == 'uniaxial':
925                uniSizer = wx.BoxSizer(wx.HORIZONTAL)
926                uniSizer.Add(TopSizer(' Domain size model: ',['isotropic','uniaxial','ellipsoidal'],
927                    'Size',OnSizeType),0,WACV)
928                uniSizer.Add(LGmixSizer('Size',OnLGmixVal,OnLGmixRef))
929                uniSizer.Add(ResetSizer('uniaxial',OnResetSize),0,WACV)
930                mainSizer.Add(UniSizer('Size',OnSizeAxis),0,WACV)
931                mainSizer.Add(uniSizer)
932                mainSizer.Add(UniDataSizer(u'size(\xb5m): ','Size','%.5f',OnSizeVal,OnSizeRef))
933            elif UseList[hist]['Size'][0] == 'ellipsoidal':
934                ellSizer = wx.BoxSizer(wx.HORIZONTAL)
935                ellSizer.Add(TopSizer(' Domain size model: ',['isotropic','uniaxial','ellipsoidal'],
936                    'Size',OnSizeType),0,WACV)
937                ellSizer.Add(LGmixSizer('Size',OnLGmixVal,OnLGmixRef))
938                ellSizer.Add(ResetSizer('ellipsoidal',OnResetSize),0,WACV)
939                mainSizer.Add(ellSizer)
940                mainSizer.Add(EllSizeDataSizer())
941            mainSizer.Add((0,5),0)                   
942           
943            if UseList[hist]['Mustrain'][0] == 'isotropic':
944                isoSizer = wx.BoxSizer(wx.HORIZONTAL)
945                isoSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',],
946                    'Mustrain',OnStrainType),0,WACV)
947                isoSizer.Add(LGmixSizer('Mustrain',OnLGmixVal,OnLGmixRef))
948                isoSizer.Add(ResetSizer('isotropic',OnResetStrain),0,WACV)
949                mainSizer.Add(isoSizer)
950                mainSizer.Add(IsoSizer(' microstrain: ','Mustrain','%.1f',
951                    OnStrainVal,OnStrainRef),0,WACV)                   
952                mainSizer.Add((0,5),0)
953            elif UseList[hist]['Mustrain'][0] == 'uniaxial':
954                uniSizer = wx.BoxSizer(wx.HORIZONTAL)
955                uniSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',],
956                    'Mustrain',OnStrainType),0,WACV)
957                uniSizer.Add(LGmixSizer('Mustrain',OnLGmixVal,OnLGmixRef))
958                uniSizer.Add(ResetSizer('uniaxial',OnResetStrain),0,WACV)
959                mainSizer.Add(uniSizer)
960                mainSizer.Add(UniSizer('Mustrain',OnStrainAxis),0,WACV)
961                mainSizer.Add(UniDataSizer('mustrain: ','Mustrain','%.1f',OnStrainVal,OnStrainRef))
962            elif UseList[hist]['Mustrain'][0] == 'generalized':
963                genSizer = wx.BoxSizer(wx.HORIZONTAL)
964                genSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',],
965                    'Mustrain',OnStrainType),0,WACV)
966                genSizer.Add(LGmixSizer('Mustrain',OnLGmixVal,OnLGmixRef))
967                genSizer.Add(ResetSizer('generalized',OnResetStrain),0,WACV)
968                mainSizer.Add(genSizer)
969                mainSizer.Add(GenStrainDataSizer())                       
970            mainSizer.Add((0,5),0)
971           
972            mainSizer.Add(wx.StaticText(DData,-1,' Hydrostatic/elastic strain:'))
973            mainSizer.Add(HstrainSizer())
974               
975            #texture  'Pref. Ori.':['MD',1.0,False,[0,0,1],0,[]] last two for 'SH' are SHorder & coeff
976            poSizer = wx.BoxSizer(wx.VERTICAL)
977            POData = UseList[hist]['Pref.Ori.']
978            poSizer.Add(PoTopSizer(POData))
979            if POData[0] == 'MD':
980                poSizer.Add(MDDataSizer(POData))
981            else:           #'SH'
982                if POData[4]:       #SH order > 0
983                    poSizer.Add(SHDataSizer(POData))
984                   
985            mainSizer.Add(poSizer)
986            mainSizer.Add((0,5),0)               
987            mainSizer.Add(ExtSizer())
988            mainSizer.Add((0,5),0)
989            mainSizer.Add(BabSizer())
990            mainSizer.Add((0,5),0)
991        elif hist[:4] == 'HKLF':
992            mainSizer.Add((0,5),0)               
993            mainSizer.Add(SCExtSizer())
994            mainSizer.Add((0,5),0)
995            mainSizer.Add(BabSizer())
996            mainSizer.Add((0,5),0)
997            pass
998   
999    mainSizer.Add((5,5),0)
1000    G2phsGUI.SetPhaseWindow(G2frame.dataFrame,DData,mainSizer)
Note: See TracBrowser for help on using the repository browser.