source: trunk/GSASIIddataGUI.py @ 1547

Last change on this file since 1547 was 1547, checked in by vondreele, 9 years ago

change "Crystal size" to "Domain size"
use lookups for allowed super symmetries for GSAS-II standard space groups as used in the indexing routine.
supersymmetry for trigonal/rhomahedral & hexagonal all complete & checked
supersylmmetry for monoclinic & tetragonal all complete but get errors
orthorhombic not done yet
min Nc/No? set to 2 (at 1 it failed) for indexing

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