1 | # -*- coding: utf-8 -*- |
---|
2 | #GSASII - phase data display routines |
---|
3 | ########### SVN repository information ################### |
---|
4 | # $Date: 2021-01-26 18:48:52 +0000 (Tue, 26 Jan 2021) $ |
---|
5 | # $Author: toby $ |
---|
6 | # $Revision: 4783 $ |
---|
7 | # $URL: trunk/GSASIIddataGUI.py $ |
---|
8 | # $Id: GSASIIddataGUI.py 4783 2021-01-26 18:48:52Z toby $ |
---|
9 | ########### SVN repository information ################### |
---|
10 | ''' |
---|
11 | *GSASIIddataGUI: Phase Diffraction Data GUI* |
---|
12 | -------------------------------------------- |
---|
13 | |
---|
14 | Module to create the GUI for display of diffraction data * phase |
---|
15 | information that is shown in the data display window |
---|
16 | (when a phase is selected.) |
---|
17 | |
---|
18 | ''' |
---|
19 | from __future__ import division, print_function |
---|
20 | import wx |
---|
21 | import numpy as np |
---|
22 | import numpy.linalg as nl |
---|
23 | import GSASIIpath |
---|
24 | GSASIIpath.SetVersionNumber("$Revision: 4783 $") |
---|
25 | import GSASIIlattice as G2lat |
---|
26 | import GSASIIspc as G2spc |
---|
27 | import GSASIIplot as G2plt |
---|
28 | import GSASIIpwd as G2pwd |
---|
29 | import GSASIIphsGUI as G2phG |
---|
30 | import GSASIIctrlGUI as G2G |
---|
31 | import GSASIIpy3 as G2py3 |
---|
32 | |
---|
33 | WACV = wx.ALIGN_CENTER_VERTICAL |
---|
34 | VERY_LIGHT_GREY = wx.Colour(235,235,235) |
---|
35 | WHITE = wx.Colour(255,255,255) |
---|
36 | BLACK = wx.Colour(0,0,0) |
---|
37 | mapDefault = {'MapType':'','RefList':'','GridStep':0.25,'Show bonds':True, |
---|
38 | 'rho':[],'rhoMax':0.,'mapSize':10.0,'cutOff':50.,'Flip':False} |
---|
39 | |
---|
40 | ################################################################################ |
---|
41 | ##### DData routines |
---|
42 | ################################################################################ |
---|
43 | def UpdateDData(G2frame,DData,data,hist='',Scroll=0): |
---|
44 | '''Display the Diffraction Data associated with a phase |
---|
45 | (items where there is a value for each histogram and phase) |
---|
46 | |
---|
47 | :param wx.frame G2frame: the main GSAS-II frame object |
---|
48 | :param wx.ScrolledWindow DData: notebook page to be used for the display |
---|
49 | :param dict data: all the information on the phase in a dictionary |
---|
50 | :param str hist: histogram name |
---|
51 | :param int Scroll: previous scroll position |
---|
52 | |
---|
53 | ''' |
---|
54 | def PlotSizer(): |
---|
55 | |
---|
56 | def OnPlotSel(event): |
---|
57 | Obj = event.GetEventObject() |
---|
58 | generalData['Data plot type'] = Obj.GetStringSelection() |
---|
59 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
60 | wx.CallLater(100,UpdateDData,G2frame,DData,data,G2frame.hist) |
---|
61 | |
---|
62 | def OnPOhkl(event): |
---|
63 | event.Skip() |
---|
64 | Obj = event.GetEventObject() |
---|
65 | Saxis = Obj.GetValue().split() |
---|
66 | try: |
---|
67 | hkl = [int(Saxis[i]) for i in range(3)] |
---|
68 | except (ValueError,IndexError): |
---|
69 | hkl = generalData['POhkl'] |
---|
70 | if not np.any(np.array(hkl)): |
---|
71 | hkl = generalData['POhkl'] |
---|
72 | generalData['POhkl'] = hkl |
---|
73 | h,k,l = hkl |
---|
74 | Obj.SetValue('%3d %3d %3d'%(h,k,l)) |
---|
75 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
76 | |
---|
77 | def OnProj(event): |
---|
78 | Obj = event.GetEventObject() |
---|
79 | generalData['3Dproj'] = Obj.GetValue() |
---|
80 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
81 | |
---|
82 | plotSizer = wx.BoxSizer(wx.VERTICAL) |
---|
83 | choice = ['None','Mustrain','Size','Preferred orientation','St. proj. Inv. pole figure','Eq. area Inv. pole figure'] |
---|
84 | plotSel = wx.RadioBox(DData,wx.ID_ANY,'Select plot type:',choices=choice, |
---|
85 | majorDimension=1,style=wx.RA_SPECIFY_COLS) |
---|
86 | plotSel.SetStringSelection(generalData['Data plot type']) |
---|
87 | plotSel.Bind(wx.EVT_RADIOBOX,OnPlotSel) |
---|
88 | plotSizer.Add(plotSel) |
---|
89 | if generalData['Data plot type'] == 'Preferred orientation': |
---|
90 | POhklSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
91 | POhklSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Plot preferred orientation for H K L: '),0,WACV) |
---|
92 | h,k,l = generalData['POhkl'] |
---|
93 | poAxis = wx.TextCtrl(DData,wx.ID_ANY,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER) |
---|
94 | poAxis.Bind(wx.EVT_TEXT_ENTER,OnPOhkl) |
---|
95 | poAxis.Bind(wx.EVT_KILL_FOCUS,OnPOhkl) |
---|
96 | POhklSizer.Add(poAxis,0,WACV) |
---|
97 | plotSizer.Add(POhklSizer) |
---|
98 | elif generalData['Data plot type'] in ['Mustrain','Size']: |
---|
99 | projSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
100 | projSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Show projections for: '),0,WACV) |
---|
101 | proj = ['','x','y','z','xy','xz','yz','xyz'] |
---|
102 | projType = wx.ComboBox(DData,wx.ID_ANY,value=generalData['3Dproj'],choices=proj, |
---|
103 | style=wx.CB_READONLY|wx.CB_DROPDOWN) |
---|
104 | projType.Bind(wx.EVT_COMBOBOX, OnProj) |
---|
105 | projSizer.Add(projType,0,WACV) |
---|
106 | plotSizer.Add(projSizer) |
---|
107 | return plotSizer |
---|
108 | |
---|
109 | def ScaleSizer(): |
---|
110 | |
---|
111 | def OnScaleRef(event): |
---|
112 | Obj = event.GetEventObject() |
---|
113 | UseList[G2frame.hist]['Scale'][1] = Obj.GetValue() |
---|
114 | def onChangeFraction(invalid,value,tc): |
---|
115 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
116 | |
---|
117 | scaleSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
118 | if 'PWDR' in G2frame.hist: |
---|
119 | scaleRef = wx.CheckBox(DData,wx.ID_ANY,label=' Phase fraction: ') |
---|
120 | elif 'HKLF' in G2frame.hist: |
---|
121 | scaleRef = wx.CheckBox(DData,wx.ID_ANY,label=' Scale factor: ') |
---|
122 | scaleRef.SetValue(UseList[G2frame.hist]['Scale'][1]) |
---|
123 | scaleRef.Bind(wx.EVT_CHECKBOX, OnScaleRef) |
---|
124 | scaleSizer.Add(scaleRef,0,WACV|wx.LEFT,5) |
---|
125 | scaleVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Scale'],0, |
---|
126 | xmin=0.,nDig=(10,4),typeHint=float,OnLeave=onChangeFraction) |
---|
127 | scaleSizer.Add(scaleVal,0,WACV) |
---|
128 | if 'PWDR' in G2frame.hist and generalData['Type'] != 'magnetic': |
---|
129 | wtSum = G2pwd.PhaseWtSum(G2frame,G2frame.hist) |
---|
130 | if wtSum and UseList[G2frame.hist]['Use']: |
---|
131 | weightFr = UseList[G2frame.hist]['Scale'][0]*generalData['Mass']/wtSum |
---|
132 | scaleSizer.Add(wx.StaticText(DData,label=' Wt. fraction: %.3f'%(weightFr)),0,WACV) |
---|
133 | return scaleSizer |
---|
134 | |
---|
135 | def OnLGmixRef(event): |
---|
136 | Obj = event.GetEventObject() |
---|
137 | hist,name = Indx[Obj.GetId()] |
---|
138 | UseList[G2frame.hist][name][2][2] = Obj.GetValue() |
---|
139 | |
---|
140 | def OnSizeType(event): |
---|
141 | Obj = event.GetEventObject() |
---|
142 | UseList[G2frame.hist]['Size'][0] = Obj.GetValue() |
---|
143 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
144 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
145 | |
---|
146 | def OnSizeRef(event): |
---|
147 | Obj = event.GetEventObject() |
---|
148 | hist,pid = Indx[Obj.GetId()] |
---|
149 | if UseList[G2frame.hist]['Size'][0] == 'ellipsoidal': |
---|
150 | UseList[G2frame.hist]['Size'][5][pid] = Obj.GetValue() |
---|
151 | else: |
---|
152 | UseList[G2frame.hist]['Size'][2][pid] = Obj.GetValue() |
---|
153 | |
---|
154 | def OnStrainType(event): |
---|
155 | Obj = event.GetEventObject() |
---|
156 | UseList[G2frame.hist]['Mustrain'][0] = Obj.GetValue() |
---|
157 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
158 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
159 | |
---|
160 | def OnStrainRef(event): |
---|
161 | Obj = event.GetEventObject() |
---|
162 | hist,pid = Indx[Obj.GetId()] |
---|
163 | if UseList[G2frame.hist]['Mustrain'][0] == 'generalized': |
---|
164 | UseList[G2frame.hist]['Mustrain'][5][pid] = Obj.GetValue() |
---|
165 | else: |
---|
166 | UseList[G2frame.hist]['Mustrain'][2][pid] = Obj.GetValue() |
---|
167 | |
---|
168 | def OnStrainAxis(event): |
---|
169 | event.Skip() |
---|
170 | Obj = event.GetEventObject() |
---|
171 | Saxis = Obj.GetValue().split() |
---|
172 | try: |
---|
173 | hkl = [int(Saxis[i]) for i in range(3)] |
---|
174 | except (ValueError,IndexError): |
---|
175 | hkl = UseList[G2frame.hist]['Mustrain'][3] |
---|
176 | if not np.any(np.array(hkl)): |
---|
177 | hkl = UseList[G2frame.hist]['Mustrain'][3] |
---|
178 | UseList[G2frame.hist]['Mustrain'][3] = hkl |
---|
179 | h,k,l = hkl |
---|
180 | Obj.SetValue('%3d %3d %3d'%(h,k,l)) |
---|
181 | wx.CallAfter(G2plt.PlotSizeStrainPO,G2frame,data,hist) |
---|
182 | |
---|
183 | def OnResetStrain(event): |
---|
184 | Obj = event.GetEventObject() |
---|
185 | item,name = Indx[Obj.GetId()] |
---|
186 | if name == 'isotropic': |
---|
187 | UseList[item]['Mustrain'][1][0] = 1000.0 |
---|
188 | elif name == 'uniaxial': |
---|
189 | UseList[item]['Mustrain'][1][0] = 1000.0 |
---|
190 | UseList[item]['Mustrain'][1][1] = 1000.0 |
---|
191 | elif name == 'generalized': |
---|
192 | muiso = 1000. |
---|
193 | cell = generalData['Cell'][1:7] |
---|
194 | vals = G2spc.Muiso2Shkl(muiso,SGData,cell) |
---|
195 | UseList[item]['Mustrain'][4] = vals |
---|
196 | G2plt.PlotSizeStrainPO(G2frame,data,item) |
---|
197 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
198 | |
---|
199 | def OnPOAxis(event): |
---|
200 | event.Skip() |
---|
201 | Obj = event.GetEventObject() |
---|
202 | Saxis = Obj.GetValue().split() |
---|
203 | try: |
---|
204 | hkl = [int(Saxis[i]) for i in range(3)] |
---|
205 | except (ValueError,IndexError): |
---|
206 | hkl = UseList[G2frame.hist]['Pref.Ori.'][3] |
---|
207 | if not np.any(np.array(hkl)): |
---|
208 | hkl = UseList[G2frame.hist]['Pref.Ori.'][3] |
---|
209 | UseList[G2frame.hist]['Pref.Ori.'][3] = hkl |
---|
210 | h,k,l = hkl |
---|
211 | Obj.SetValue('%3d %3d %3d'%(h,k,l)) |
---|
212 | |
---|
213 | def OnPOOrder(event): |
---|
214 | Obj = event.GetEventObject() |
---|
215 | Order = int(Obj.GetValue()) |
---|
216 | UseList[G2frame.hist]['Pref.Ori.'][4] = Order |
---|
217 | UseList[G2frame.hist]['Pref.Ori.'][5] = SetPOCoef(Order,G2frame.hist) |
---|
218 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
219 | |
---|
220 | def OnPOType(event): |
---|
221 | Obj = event.GetEventObject() |
---|
222 | if 'March' in Obj.GetValue(): |
---|
223 | UseList[G2frame.hist]['Pref.Ori.'][0] = 'MD' |
---|
224 | else: |
---|
225 | UseList[G2frame.hist]['Pref.Ori.'][0] = 'SH' |
---|
226 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
227 | |
---|
228 | def OnPORef(event): |
---|
229 | Obj = event.GetEventObject() |
---|
230 | UseList[G2frame.hist]['Pref.Ori.'][2] = Obj.GetValue() |
---|
231 | |
---|
232 | def SetPOCoef(Order,hist): |
---|
233 | cofNames = G2lat.GenSHCoeff(SGData['SGLaue'],'0',Order,False) #cylindrical & no M |
---|
234 | newPOCoef = dict(zip(cofNames,np.zeros(len(cofNames)))) |
---|
235 | POCoeff = UseList[G2frame.hist]['Pref.Ori.'][5] |
---|
236 | for cofName in POCoeff: |
---|
237 | if cofName in cofNames: |
---|
238 | newPOCoef[cofName] = POCoeff[cofName] |
---|
239 | return newPOCoef |
---|
240 | |
---|
241 | def checkAxis(axis): |
---|
242 | if not np.any(np.array(axis)): |
---|
243 | return False |
---|
244 | return axis |
---|
245 | |
---|
246 | def OnNewValue(invalid,value,tc): |
---|
247 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
248 | |
---|
249 | def OnNewValueReDraw(invalid,value,tc): |
---|
250 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
251 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
252 | |
---|
253 | def TopSizer(name,choices,parm,OnType): |
---|
254 | topSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
255 | topSizer.Add(wx.StaticText(DData,wx.ID_ANY,name),0,WACV) |
---|
256 | sizeType = wx.ComboBox(DData,wx.ID_ANY,value=UseList[G2frame.hist][parm][0],choices=choices, |
---|
257 | style=wx.CB_READONLY|wx.CB_DROPDOWN) |
---|
258 | sizeType.Bind(wx.EVT_COMBOBOX, OnType) |
---|
259 | topSizer.Add(sizeType,0,WACV|wx.BOTTOM,5) |
---|
260 | return topSizer |
---|
261 | |
---|
262 | def LGmixSizer(name,Limits,OnRef): |
---|
263 | lgmixSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
264 | lgmixRef = wx.CheckBox(DData,wx.ID_ANY,label='LGmix') |
---|
265 | lgmixRef.thisown = False |
---|
266 | lgmixRef.SetValue(UseList[G2frame.hist][name][2][2]) |
---|
267 | Indx[lgmixRef.GetId()] = [G2frame.hist,name] |
---|
268 | lgmixRef.Bind(wx.EVT_CHECKBOX, OnRef) |
---|
269 | lgmixSizer.Add(lgmixRef,0,WACV|wx.LEFT,5) |
---|
270 | lgmixVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist][name][1],2, |
---|
271 | nDig=(10,3),xmin=Limits[0],xmax=Limits[1]) |
---|
272 | lgmixSizer.Add(lgmixVal,0,WACV|wx.LEFT,5) |
---|
273 | return lgmixSizer |
---|
274 | |
---|
275 | def ResetSizer(name,OnReset): |
---|
276 | resetSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
277 | reset = wx.Button(DData,wx.ID_ANY,label='Reset?') |
---|
278 | reset.thisown = False |
---|
279 | Indx[reset.GetId()] = [G2frame.hist,name] |
---|
280 | reset.Bind(wx.EVT_BUTTON,OnReset) |
---|
281 | resetSizer.Add(reset,0,WACV) |
---|
282 | return resetSizer |
---|
283 | |
---|
284 | def IsoSizer(name,parm,fmt,Limits,OnRef): |
---|
285 | isoSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
286 | sizeRef = wx.CheckBox(DData,wx.ID_ANY,label=name) |
---|
287 | sizeRef.thisown = False |
---|
288 | sizeRef.SetValue(UseList[G2frame.hist][parm][2][0]) |
---|
289 | Indx[sizeRef.GetId()] = [G2frame.hist,0] |
---|
290 | sizeRef.Bind(wx.EVT_CHECKBOX, OnRef) |
---|
291 | isoSizer.Add(sizeRef,0,WACV|wx.LEFT,5) |
---|
292 | sizeVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist][parm][1],0, |
---|
293 | nDig=fmt,xmin=Limits[0],xmax=Limits[1],OnLeave=OnNewValue) |
---|
294 | isoSizer.Add(sizeVal,0,WACV) |
---|
295 | return isoSizer |
---|
296 | |
---|
297 | def UniSizer(parm,OnAxis): |
---|
298 | uniSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
299 | uniSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Unique axis, H K L: '),0,WACV) |
---|
300 | h,k,l = UseList[G2frame.hist][parm][3] |
---|
301 | Axis = wx.TextCtrl(DData,wx.ID_ANY,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER) |
---|
302 | Axis.Bind(wx.EVT_TEXT_ENTER,OnAxis) |
---|
303 | Axis.Bind(wx.EVT_KILL_FOCUS,OnAxis) |
---|
304 | uniSizer.Add(Axis,0,WACV|wx.LEFT,5) |
---|
305 | return uniSizer |
---|
306 | |
---|
307 | def UniDataSizer(parmName,parm,fmt,Limits,OnRef): |
---|
308 | dataSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
309 | parms = zip([' Equatorial '+parmName,' Axial '+parmName], |
---|
310 | UseList[G2frame.hist][parm][2],range(2)) |
---|
311 | for Pa,ref,Id in parms: |
---|
312 | sizeRef = wx.CheckBox(DData,wx.ID_ANY,label=Pa) |
---|
313 | sizeRef.thisown = False |
---|
314 | sizeRef.SetValue(ref) |
---|
315 | Indx[sizeRef.GetId()] = [G2frame.hist,Id] |
---|
316 | sizeRef.Bind(wx.EVT_CHECKBOX, OnRef) |
---|
317 | dataSizer.Add(sizeRef,0,WACV|wx.LEFT,5) |
---|
318 | sizeVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist][parm][1], |
---|
319 | Id,fmt,xmin=Limits[0],xmax=Limits[1],OnLeave=OnNewValue) |
---|
320 | dataSizer.Add(sizeVal,0,WACV) |
---|
321 | return dataSizer |
---|
322 | |
---|
323 | def EllSizeDataSizer(): |
---|
324 | parms = zip(['S11','S22','S33','S12','S13','S23'],UseList[G2frame.hist]['Size'][4], |
---|
325 | UseList[G2frame.hist]['Size'][5],range(6)) |
---|
326 | dataSizer = wx.BoxSizer(wx.VERTICAL) |
---|
327 | matrixSizer = wx.FlexGridSizer(0,6,5,5) |
---|
328 | Sij = [] |
---|
329 | for Pa,val,ref,Id in parms: |
---|
330 | sizeRef = wx.CheckBox(DData,wx.ID_ANY,label=Pa) |
---|
331 | sizeRef.thisown = False |
---|
332 | sizeRef.SetValue(ref) |
---|
333 | Indx[sizeRef.GetId()] = [G2frame.hist,Id] |
---|
334 | sizeRef.Bind(wx.EVT_CHECKBOX, OnSizeRef) |
---|
335 | matrixSizer.Add(sizeRef,0,WACV) |
---|
336 | if Id < 3: |
---|
337 | sizeVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Size'][4], |
---|
338 | Id,nDig=(10,3),xmin=0.,xmax=4.,OnLeave=OnNewValueReDraw) |
---|
339 | else: |
---|
340 | sizeVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Size'][4], |
---|
341 | Id,nDig=(10,3),OnLeave=OnNewValueReDraw) |
---|
342 | # Create Sij matrix |
---|
343 | Sij += [val] |
---|
344 | matrixSizer.Add(sizeVal,0,WACV) |
---|
345 | dataSizer.Add(matrixSizer, 0) |
---|
346 | Esize,Rsize = nl.eigh(G2lat.U6toUij(np.asarray(Sij))) |
---|
347 | lengths = Esize |
---|
348 | G,g = G2lat.cell2Gmat(data['General']['Cell'][1:7]) #recip & real metric tensors |
---|
349 | GA,GB = G2lat.Gmat2AB(G) #Orthogonalization matricies |
---|
350 | hkls = [x/(sum(x**2)**0.5) for x in np.dot(Rsize, GA)] |
---|
351 | Ids = np.argsort(lengths) |
---|
352 | dataSizer.Add(wx.StaticText(DData,label=' Principal ellipsoid components:'),0) |
---|
353 | compSizer = wx.FlexGridSizer(3,3,5,5) |
---|
354 | Axes = [' Short Axis:',' Middle Axis:',' Long Axis:'] |
---|
355 | for Id in Ids: |
---|
356 | compSizer.Add(wx.StaticText(DData,label=Axes[Id]),0,WACV) |
---|
357 | compSizer.Add(wx.StaticText(DData,label='(%.3f, %.3f, %.3f) '%(hkls[Id][0], hkls[Id][1], hkls[Id][2])),0,WACV) |
---|
358 | compSizer.Add(wx.StaticText(DData,label='Length: %.3f'%lengths[Id]),0,WACV) |
---|
359 | dataSizer.Add(compSizer) |
---|
360 | return dataSizer |
---|
361 | |
---|
362 | def GenStrainDataSizer(): |
---|
363 | Snames = G2spc.MustrainNames(SGData) |
---|
364 | numb = len(Snames) |
---|
365 | onumb = len(UseList[G2frame.hist]['Mustrain'][4]) |
---|
366 | while onumb < numb: |
---|
367 | UseList[G2frame.hist]['Mustrain'][4].append(0.0) |
---|
368 | UseList[G2frame.hist]['Mustrain'][5].append(False) |
---|
369 | onumb += 1 |
---|
370 | muMean = G2spc.MuShklMean(SGData,Amat,UseList[G2frame.hist]['Mustrain'][4][:numb]) |
---|
371 | parms = zip(Snames,UseList[G2frame.hist]['Mustrain'][5],range(numb)) |
---|
372 | mainSizer = wx.BoxSizer(wx.VERTICAL) |
---|
373 | dataSizer = wx.FlexGridSizer(0,6,5,5) |
---|
374 | for Pa,ref,Id in parms: |
---|
375 | strainRef = wx.CheckBox(DData,wx.ID_ANY,label=Pa) |
---|
376 | strainRef.thisown = False |
---|
377 | strainRef.SetValue(ref) |
---|
378 | Indx[strainRef.GetId()] = [G2frame.hist,Id] |
---|
379 | strainRef.Bind(wx.EVT_CHECKBOX, OnStrainRef) |
---|
380 | dataSizer.Add(strainRef,0,WACV) |
---|
381 | strainVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Mustrain'][4], |
---|
382 | Id,nDig=(10,2),OnLeave=OnNewValueReDraw) |
---|
383 | dataSizer.Add(strainVal,0,WACV) |
---|
384 | mainSizer.Add(dataSizer) |
---|
385 | mainSizer.Add(wx.StaticText(DData,label=' Mean mustrain %.1f'%muMean) |
---|
386 | ,0,wx.ALIGN_CENTER_HORIZONTAL) |
---|
387 | return mainSizer |
---|
388 | |
---|
389 | def HstrainSizer(): |
---|
390 | |
---|
391 | def OnHstrainRef(event): |
---|
392 | Obj = event.GetEventObject() |
---|
393 | hist,pid = Indx[Obj.GetId()] |
---|
394 | UseList[G2frame.hist]['HStrain'][1][pid] = Obj.GetValue() |
---|
395 | |
---|
396 | hSizer = wx.BoxSizer(wx.VERTICAL) |
---|
397 | hstrainSizer = wx.FlexGridSizer(0,6,5,5) |
---|
398 | Hsnames = G2spc.HStrainNames(SGData) |
---|
399 | parms = zip(Hsnames,UseList[G2frame.hist]['HStrain'][1],range(len(Hsnames))) |
---|
400 | allzero = True |
---|
401 | for Pa,ref,Id in parms: |
---|
402 | hstrainRef = wx.CheckBox(DData,wx.ID_ANY,label=Pa) |
---|
403 | hstrainRef.thisown = False |
---|
404 | hstrainRef.SetValue(ref) |
---|
405 | Indx[hstrainRef.GetId()] = [G2frame.hist,Id] |
---|
406 | hstrainRef.Bind(wx.EVT_CHECKBOX, OnHstrainRef) |
---|
407 | hstrainSizer.Add(hstrainRef,0,WACV|wx.LEFT,5) |
---|
408 | hstrainVal = G2G.ValidatedTxtCtrl(DData, |
---|
409 | UseList[G2frame.hist]['HStrain'][0],Id,nDig=(10,3,'g'), |
---|
410 | OnLeave=OnNewValueReDraw) |
---|
411 | if abs(UseList[G2frame.hist]['HStrain'][0][Id]) > 1e-8: |
---|
412 | allzero = False |
---|
413 | hstrainSizer.Add(hstrainVal,0,WACV) |
---|
414 | hSizer.Add(hstrainSizer,0) |
---|
415 | if not allzero: # show Dij shifted unit cell |
---|
416 | DijVals = UseList[G2frame.hist]['HStrain'][0][:] |
---|
417 | # apply the Dij values to the reciprocal cell |
---|
418 | newA = [] |
---|
419 | Dijdict = dict(zip(G2spc.HStrainNames(SGData),DijVals)) |
---|
420 | for Aij,lbl in zip(G2lat.cell2A(data['General']['Cell'][1:7]), |
---|
421 | ['D11','D22','D33','D12','D13','D23']): |
---|
422 | newA.append(Aij + Dijdict.get(lbl,0.0)) |
---|
423 | cell = G2lat.A2cell(newA) # convert back to direct cell |
---|
424 | laue = generalData['SGData']['SGLaue'] |
---|
425 | if laue == '2/m': |
---|
426 | laue += generalData['SGData']['SGUniq'] |
---|
427 | for cellGUI in G2py3.cellGUIlist: |
---|
428 | if laue in cellGUI[0]: |
---|
429 | useGUI = cellGUI |
---|
430 | break |
---|
431 | else: |
---|
432 | return hSizer |
---|
433 | cellstr = '' |
---|
434 | for txt,fmt,ifEdit,Id in zip(*useGUI[2:]): |
---|
435 | if cellstr: cellstr += ", " |
---|
436 | cellstr += txt+fmt.format(cell[Id]) |
---|
437 | cellstr += ', Vol = {:.3f}'.format(G2lat.calc_V(newA)) |
---|
438 | hSizer.Add(wx.StaticText(DData,wx.ID_ANY,' '+cellstr),0) |
---|
439 | return hSizer |
---|
440 | |
---|
441 | def PoTopSizer(POData): |
---|
442 | poSizer = wx.FlexGridSizer(0,6,5,5) |
---|
443 | choice = ['March-Dollase','Spherical harmonics'] |
---|
444 | POtype = choice[['MD','SH'].index(POData[0])] |
---|
445 | poSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Preferred orientation model '),0,WACV) |
---|
446 | POType = wx.ComboBox(DData,wx.ID_ANY,value=POtype,choices=choice, |
---|
447 | style=wx.CB_READONLY|wx.CB_DROPDOWN) |
---|
448 | POType.Bind(wx.EVT_COMBOBOX, OnPOType) |
---|
449 | poSizer.Add(POType) |
---|
450 | if POData[0] == 'SH': |
---|
451 | poSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Harmonic order: '),0,WACV) |
---|
452 | poOrder = wx.ComboBox(DData,wx.ID_ANY,value=str(POData[4]),choices=[str(2*i) for i in range(18)], |
---|
453 | style=wx.CB_READONLY|wx.CB_DROPDOWN) |
---|
454 | poOrder.Bind(wx.EVT_COMBOBOX,OnPOOrder) |
---|
455 | poSizer.Add(poOrder,0,WACV) |
---|
456 | poRef = wx.CheckBox(DData,wx.ID_ANY,label=' Refine? ') |
---|
457 | poRef.SetValue(POData[2]) |
---|
458 | poRef.Bind(wx.EVT_CHECKBOX,OnPORef) |
---|
459 | poSizer.Add(poRef,0,WACV) |
---|
460 | return poSizer |
---|
461 | |
---|
462 | def MDDataSizer(POData): |
---|
463 | poSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
464 | poRef = wx.CheckBox(DData,wx.ID_ANY,label=' March-Dollase ratio: ') |
---|
465 | poRef.SetValue(POData[2]) |
---|
466 | poRef.Bind(wx.EVT_CHECKBOX,OnPORef) |
---|
467 | poSizer.Add(poRef,0,WACV|wx.LEFT,5) |
---|
468 | poVal = G2G.ValidatedTxtCtrl(DData,POData,1,nDig=(10,3),typeHint=float,xmin=0.) |
---|
469 | poSizer.Add(poVal,0,WACV) |
---|
470 | poSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Unique axis, H K L: '),0,WACV) |
---|
471 | h,k,l =POData[3] |
---|
472 | poAxis = wx.TextCtrl(DData,wx.ID_ANY,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER) |
---|
473 | poAxis.Bind(wx.EVT_TEXT_ENTER,OnPOAxis) |
---|
474 | poAxis.Bind(wx.EVT_KILL_FOCUS,OnPOAxis) |
---|
475 | poSizer.Add(poAxis,0,WACV) |
---|
476 | return poSizer |
---|
477 | |
---|
478 | def SHDataSizer(POData): |
---|
479 | |
---|
480 | ODFSizer = wx.FlexGridSizer(0,8,2,2) |
---|
481 | ODFkeys = list(POData[5].keys()) |
---|
482 | ODFkeys.sort() |
---|
483 | for odf in ODFkeys: |
---|
484 | ODFSizer.Add(wx.StaticText(DData,wx.ID_ANY,odf),0,WACV) |
---|
485 | ODFval = G2G.ValidatedTxtCtrl(DData,POData[5],odf,nDig=(8,3),typeHint=float,OnLeave=OnNewValue) |
---|
486 | ODFSizer.Add(ODFval,0,WACV|wx.LEFT,5) |
---|
487 | return ODFSizer |
---|
488 | |
---|
489 | def SHPenalty(POData): |
---|
490 | |
---|
491 | def OnHKLList(event): |
---|
492 | dlg = G2G.G2MultiChoiceDialog(G2frame, 'Select penalty hkls', |
---|
493 | 'Penalty hkls',hkls,filterBox=False) |
---|
494 | try: |
---|
495 | if dlg.ShowModal() == wx.ID_OK: |
---|
496 | POData[6] = [hkls[i] for i in dlg.GetSelections()] |
---|
497 | if not POData[6]: |
---|
498 | POData[6] = ['',] |
---|
499 | else: |
---|
500 | return |
---|
501 | finally: |
---|
502 | dlg.Destroy() |
---|
503 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
504 | |
---|
505 | A = G2lat.cell2A(generalData['Cell'][1:7]) |
---|
506 | hkls = G2lat.GenPfHKLs(10,SGData,A) |
---|
507 | shPenalty = wx.BoxSizer(wx.HORIZONTAL) |
---|
508 | shPenalty.Add(wx.StaticText(DData,wx.ID_ANY,' Negative MRD penalty list: '),0,WACV) |
---|
509 | shPenalty.Add(wx.ComboBox(DData,value=POData[6][0],choices=POData[6], |
---|
510 | style=wx.CB_DROPDOWN),0,WACV|wx.LEFT,5) |
---|
511 | hklList = wx.Button(DData,label='Select penalty hkls') |
---|
512 | hklList.Bind(wx.EVT_BUTTON,OnHKLList) |
---|
513 | shPenalty.Add(hklList,0,WACV) |
---|
514 | shPenalty.Add(wx.StaticText(DData,wx.ID_ANY,' Zero MRD tolerance: '),0,WACV) |
---|
515 | shToler = G2G.ValidatedTxtCtrl(DData,POData,7,nDig=(10,2),typeHint=float) |
---|
516 | shPenalty.Add(shToler,0,WACV) |
---|
517 | return shPenalty |
---|
518 | |
---|
519 | def ExtSizer(Type): |
---|
520 | |
---|
521 | def OnSCExtType(event): |
---|
522 | Obj = event.GetEventObject() |
---|
523 | item = Indx[Obj.GetId()] |
---|
524 | UseList[item[0]]['Extinction'][item[1]] = Obj.GetValue() |
---|
525 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
526 | |
---|
527 | def OnEref(event): |
---|
528 | Obj = event.GetEventObject() |
---|
529 | item = Indx[Obj.GetId()] |
---|
530 | UseList[item[0]]['Extinction'][2][item[1]][1] = Obj.GetValue() |
---|
531 | |
---|
532 | def OnExtRef(event): |
---|
533 | Obj = event.GetEventObject() |
---|
534 | UseList[G2frame.hist]['Extinction'][1] = Obj.GetValue() |
---|
535 | |
---|
536 | if Type == 'HKLF': |
---|
537 | extSizer = wx.BoxSizer(wx.VERTICAL) |
---|
538 | typeSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
539 | typeSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Extinction type: '),0,WACV) |
---|
540 | Choices = ['None','Primary','Secondary Type I','Secondary Type II',] # remove 'Secondary Type I & II' |
---|
541 | typeTxt = wx.ComboBox(DData,wx.ID_ANY,choices=Choices,value=UseList[G2frame.hist]['Extinction'][1], |
---|
542 | style=wx.CB_READONLY|wx.CB_DROPDOWN) |
---|
543 | Indx[typeTxt.GetId()] = [G2frame.hist,1] |
---|
544 | typeTxt.Bind(wx.EVT_COMBOBOX,OnSCExtType) |
---|
545 | typeSizer.Add(typeTxt) |
---|
546 | typeSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Approx: '),0,WACV) |
---|
547 | Choices=['Lorentzian','Gaussian'] |
---|
548 | approxTxT = wx.ComboBox(DData,wx.ID_ANY,choices=Choices,value=UseList[G2frame.hist]['Extinction'][0], |
---|
549 | style=wx.CB_READONLY|wx.CB_DROPDOWN) |
---|
550 | Indx[approxTxT.GetId()] = [G2frame.hist,0] |
---|
551 | approxTxT.Bind(wx.EVT_COMBOBOX,OnSCExtType) |
---|
552 | typeSizer.Add(approxTxT) |
---|
553 | if UseList[G2frame.hist]['Extinction'][1] == 'None': |
---|
554 | extSizer.Add(typeSizer,0) |
---|
555 | else: |
---|
556 | extSizer.Add(typeSizer,0,wx.BOTTOM,5) |
---|
557 | if 'Tbar' in UseList[G2frame.hist]['Extinction'][2]: #skipped for TOF |
---|
558 | valSizer =wx.BoxSizer(wx.HORIZONTAL) |
---|
559 | valSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Tbar(mm):'),0,WACV) |
---|
560 | tbarVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Extinction'][2],'Tbar', |
---|
561 | xmin=0.,nDig=(10,3),typeHint=float) |
---|
562 | valSizer.Add(tbarVal,0,WACV) |
---|
563 | valSizer.Add(wx.StaticText(DData,wx.ID_ANY,' cos(2ThM):'),0,WACV) |
---|
564 | cos2tm = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Extinction'][2],'Cos2TM', |
---|
565 | xmin=0.,xmax=1.,nDig=(10,3),typeHint=float) |
---|
566 | valSizer.Add(cos2tm,0,WACV) |
---|
567 | extSizer.Add(valSizer,0) |
---|
568 | val2Sizer =wx.BoxSizer(wx.HORIZONTAL) |
---|
569 | if 'Primary' in UseList[G2frame.hist]['Extinction'][1]: |
---|
570 | Ekey = ['Ep',] |
---|
571 | elif 'Secondary Type II' == UseList[G2frame.hist]['Extinction'][1]: |
---|
572 | Ekey = ['Es',] |
---|
573 | elif 'Secondary Type I' == UseList[G2frame.hist]['Extinction'][1]: |
---|
574 | Ekey = ['Eg',] |
---|
575 | else: |
---|
576 | Ekey = ['Eg','Es'] |
---|
577 | for ekey in Ekey: |
---|
578 | Eref = wx.CheckBox(DData,wx.ID_ANY,label=ekey+' : ') |
---|
579 | Eref.SetValue(UseList[G2frame.hist]['Extinction'][2][ekey][1]) |
---|
580 | Indx[Eref.GetId()] = [G2frame.hist,ekey] |
---|
581 | Eref.Bind(wx.EVT_CHECKBOX, OnEref) |
---|
582 | val2Sizer.Add(Eref,0,WACV|wx.LEFT,5) |
---|
583 | Eval = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Extinction'][2][ekey],0, |
---|
584 | xmin=0.,nDig=(10,3,'g'),typeHint=float) |
---|
585 | val2Sizer.Add(Eval,0,WACV) |
---|
586 | extSizer.Add(val2Sizer,0) |
---|
587 | else: #PWDR |
---|
588 | extSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
589 | extRef = wx.CheckBox(DData,wx.ID_ANY,label=' Extinction: ') |
---|
590 | extRef.SetValue(UseList[G2frame.hist]['Extinction'][1]) |
---|
591 | extRef.Bind(wx.EVT_CHECKBOX, OnExtRef) |
---|
592 | extSizer.Add(extRef,0,WACV|wx.LEFT,5) |
---|
593 | extVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Extinction'],0, |
---|
594 | xmin=0.,nDig=(10,2),typeHint=float) |
---|
595 | extSizer.Add(extVal,0,WACV) |
---|
596 | |
---|
597 | return extSizer |
---|
598 | |
---|
599 | def BabSizer(): |
---|
600 | |
---|
601 | def OnBabRef(event): |
---|
602 | Obj = event.GetEventObject() |
---|
603 | item,bab = Indx[Obj.GetId()] |
---|
604 | UseList[item]['Babinet']['Bab'+bab][1] = Obj.GetValue() |
---|
605 | |
---|
606 | babSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
607 | for bab in ['A','U']: |
---|
608 | babRef = wx.CheckBox(DData,wx.ID_ANY,label=' Babinet '+bab+': ') |
---|
609 | babRef.SetValue(UseList[G2frame.hist]['Babinet']['Bab'+bab][1]) |
---|
610 | Indx[babRef.GetId()] = [G2frame.hist,bab] |
---|
611 | babRef.Bind(wx.EVT_CHECKBOX, OnBabRef) |
---|
612 | babSizer.Add(babRef,0,WACV|wx.LEFT,5) |
---|
613 | babVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Babinet']['Bab'+bab],0, |
---|
614 | nDig=(10,3),xmin=0.,typeHint=float) |
---|
615 | babSizer.Add(babVal,0,WACV) |
---|
616 | return babSizer |
---|
617 | |
---|
618 | def FlackSizer(): |
---|
619 | |
---|
620 | def OnFlackRef(event): |
---|
621 | Obj = event.GetEventObject() |
---|
622 | UseList[G2frame.hist]['Flack'][1] = Obj.GetValue() |
---|
623 | |
---|
624 | flackSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
625 | flackRef = wx.CheckBox(DData,wx.ID_ANY,label=' Flack parameter: ') |
---|
626 | flackRef.SetValue(UseList[G2frame.hist]['Flack'][1]) |
---|
627 | flackRef.Bind(wx.EVT_CHECKBOX, OnFlackRef) |
---|
628 | flackSizer.Add(flackRef,0,WACV|wx.LEFT,5) |
---|
629 | flackVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Flack'],0,nDig=(10,3),typeHint=float) |
---|
630 | flackSizer.Add(flackVal,0,WACV) |
---|
631 | return flackSizer |
---|
632 | |
---|
633 | def DispSizer(): |
---|
634 | |
---|
635 | def OnDispRef(event): |
---|
636 | Obj = event.GetEventObject() |
---|
637 | UseList[G2frame.hist]['Layer Disp'][1] = Obj.GetValue() |
---|
638 | |
---|
639 | dispSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
640 | dispRef = wx.CheckBox(DData,wx.ID_ANY,label=u' Layer displacement (\xb5m): ') |
---|
641 | dispRef.SetValue(UseList[G2frame.hist]['Layer Disp'][1]) |
---|
642 | dispRef.Bind(wx.EVT_CHECKBOX, OnDispRef) |
---|
643 | dispSizer.Add(dispRef,0,WACV|wx.LEFT,5) |
---|
644 | dispSizer.Add(G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Layer Disp'],0,nDig=(10,2),typeHint=float),0,WACV) |
---|
645 | return dispSizer |
---|
646 | |
---|
647 | def twinSizer(): |
---|
648 | |
---|
649 | def OnAddTwin(event): |
---|
650 | twinMat = np.array([[-1,0,0],[0,-1,0],[0,0,-1]]) #inversion by default |
---|
651 | twinVal = 0.0 |
---|
652 | UseList[G2frame.hist]['Twins'].append([twinMat,twinVal]) |
---|
653 | nNonM = UseList[G2frame.hist]['Twins'][0][1][2] |
---|
654 | for i in range(nNonM): |
---|
655 | UseList[G2frame.hist]['Twins'].append([False,0.0]) |
---|
656 | addtwin.SetValue(False) |
---|
657 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
658 | |
---|
659 | def OnMat(event): |
---|
660 | event.Skip() |
---|
661 | Obj = event.GetEventObject() |
---|
662 | it,im = Indx[Obj.GetId()] |
---|
663 | newMat = Obj.GetValue().split() |
---|
664 | try: |
---|
665 | uvw = [int(newMat[i]) for i in range(3)] |
---|
666 | except ValueError: |
---|
667 | uvw = UseList[G2frame.hist]['Twins'][it][0][im] |
---|
668 | UseList[G2frame.hist]['Twins'][it][0][im] = uvw |
---|
669 | Obj.SetValue('%3d %3d %3d'%(uvw[0],uvw[1],uvw[2])) |
---|
670 | |
---|
671 | def OnTwinVal(invalid,value,tc): |
---|
672 | it = Indx[tc.GetId()] |
---|
673 | sumTw = 0. |
---|
674 | for it,twin in enumerate(UseList[G2frame.hist]['Twins']): |
---|
675 | if it: |
---|
676 | sumTw += twin[1] |
---|
677 | UseList[G2frame.hist]['Twins'][0][1][0] = 1.-sumTw |
---|
678 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
679 | |
---|
680 | def OnTwinRef(event): |
---|
681 | Obj = event.GetEventObject() |
---|
682 | UseList[G2frame.hist]['Twins'][0][1][1] = Obj.GetValue() |
---|
683 | |
---|
684 | def OnTwinInv(event): |
---|
685 | Obj = event.GetEventObject() |
---|
686 | it = Indx[Obj.GetId()] |
---|
687 | UseList[G2frame.hist]['Twins'][it][0] = Obj.GetValue() |
---|
688 | |
---|
689 | def OnTwinDel(event): |
---|
690 | Obj = event.GetEventObject() |
---|
691 | it = Indx[Obj.GetId()] |
---|
692 | nNonM = UseList[G2frame.hist]['Twins'][0][1][2] |
---|
693 | for i in range(nNonM): |
---|
694 | del UseList[G2frame.hist]['Twins'][1+i+it] |
---|
695 | del UseList[G2frame.hist]['Twins'][it] |
---|
696 | sumTw = 0. |
---|
697 | for it,twin in enumerate(UseList[G2frame.hist]['Twins']): |
---|
698 | if it: |
---|
699 | sumTw += twin[1] |
---|
700 | UseList[G2frame.hist]['Twins'][0][1][0] = 1.-sumTw |
---|
701 | if len(UseList[G2frame.hist]['Twins']) == 1: |
---|
702 | UseList[G2frame.hist]['Twins'][0][1][1] = False |
---|
703 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
704 | |
---|
705 | nTwin = len(UseList[G2frame.hist]['Twins']) |
---|
706 | twinsizer = wx.BoxSizer(wx.VERTICAL) |
---|
707 | topsizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
708 | topsizer.Add(wx.StaticText(DData,wx.ID_ANY,' Merohedral twins: '),0,WACV) |
---|
709 | #temporary - add twin not allowed if nonmerohedral twins present |
---|
710 | # if nTwin == 1 or 'bool' not in str(type(UseList[G2frame.hist]['Twins'][1][0])): |
---|
711 | addtwin = wx.CheckBox(DData,wx.ID_ANY,label=' Add Twin Law') |
---|
712 | addtwin.Bind(wx.EVT_CHECKBOX, OnAddTwin) |
---|
713 | topsizer.Add(addtwin,0,WACV|wx.LEFT,5) |
---|
714 | twinsizer.Add(topsizer) |
---|
715 | Indx = {} |
---|
716 | if nTwin > 1: |
---|
717 | for it,Twin in enumerate(UseList[G2frame.hist]['Twins']): |
---|
718 | twinMat,twinVal = Twin |
---|
719 | matSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
720 | if it: |
---|
721 | Style = wx.TE_PROCESS_ENTER |
---|
722 | TwVal = Twin[1] |
---|
723 | else: |
---|
724 | Style = wx.TE_READONLY |
---|
725 | TwVal = Twin[1][0] |
---|
726 | if 'bool' not in str(type(Twin[0])): |
---|
727 | matSizer.Add(wx.StaticText(DData,-1,' Twin Law: '),0,WACV|wx.LEFT,5) |
---|
728 | for im,Mat in enumerate(twinMat): |
---|
729 | mat = wx.TextCtrl(DData,wx.ID_ANY,'%3d %3d %3d'%(Mat[0],Mat[1],Mat[2]), |
---|
730 | style=Style) |
---|
731 | if it: |
---|
732 | Indx[mat.GetId()] = [it,im] |
---|
733 | mat.Bind(wx.EVT_TEXT_ENTER,OnMat) |
---|
734 | mat.Bind(wx.EVT_KILL_FOCUS,OnMat) |
---|
735 | else: |
---|
736 | mat.SetBackgroundColour(VERY_LIGHT_GREY) |
---|
737 | matSizer.Add(mat,0,WACV|wx.LEFT,5) |
---|
738 | else: |
---|
739 | matSizer.Add(wx.StaticText(DData,-1,' Nonmerohedral twin component %d: '%(it)),0,WACV|wx.LEFT,5) |
---|
740 | if not SGData['SGInv']: |
---|
741 | twinv = wx.CheckBox(DData,wx.ID_ANY,label=' Use enantiomorph?') |
---|
742 | twinv.SetValue(Twin[0]) |
---|
743 | Indx[twinv.GetId()] = it |
---|
744 | twinv.Bind(wx.EVT_CHECKBOX, OnTwinInv) |
---|
745 | matSizer.Add(twinv,0,WACV) |
---|
746 | twinsizer.Add(matSizer,0,wx.LEFT,5) |
---|
747 | valSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
748 | valSizer.Add(wx.StaticText(DData,-1,label=' Twin element fraction:'),0,WACV) |
---|
749 | if it: |
---|
750 | twinval = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Twins'][it],1,nDig=(10,3), |
---|
751 | xmin=0.,xmax=1.,typeHint=float,OnLeave=OnTwinVal) |
---|
752 | Indx[twinval.GetId()] = it |
---|
753 | else: |
---|
754 | twinval = wx.TextCtrl(DData,-1,'%.3f'%(TwVal),style=Style) |
---|
755 | twinval.SetBackgroundColour(VERY_LIGHT_GREY) |
---|
756 | valSizer.Add(twinval,0,WACV) |
---|
757 | if it and 'bool' not in str(type(Twin[0])): |
---|
758 | twindel = wx.CheckBox(DData,wx.ID_ANY,label=' Delete?') |
---|
759 | Indx[twindel.GetId()] = it |
---|
760 | twindel.Bind(wx.EVT_CHECKBOX, OnTwinDel) |
---|
761 | valSizer.Add(twindel,0,WACV) |
---|
762 | elif not it: |
---|
763 | twinref = wx.CheckBox(DData,wx.ID_ANY,label=' Refine?') |
---|
764 | twinref.SetValue(Twin[1][1]) |
---|
765 | twinref.Bind(wx.EVT_CHECKBOX, OnTwinRef) |
---|
766 | valSizer.Add(twinref,0,WACV) |
---|
767 | twinsizer.Add(valSizer,0,wx.LEFT,5) |
---|
768 | return twinsizer |
---|
769 | |
---|
770 | def OnSelect(event): |
---|
771 | G2frame.hist = G2frame.dataWindow.HistsInPhase[DData.select.GetSelection()] |
---|
772 | oldFocus = wx.Window.FindFocus() |
---|
773 | G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist) |
---|
774 | wx.CallLater(100,RepaintHistogramInfo) |
---|
775 | if oldFocus: wx.CallAfter(oldFocus.SetFocus) |
---|
776 | |
---|
777 | def RepaintHistogramInfo(Scroll=0): |
---|
778 | if 'phoenix' in wx.version(): |
---|
779 | G2frame.bottomSizer.Clear(True) |
---|
780 | # deal with case where this is called after another tree item has been selected |
---|
781 | try: |
---|
782 | DData.Shown |
---|
783 | except RuntimeError: |
---|
784 | if GSASIIpath.GetConfigValue('debug'): |
---|
785 | print('DBG: DData window deleted. Ignoring RepaintHistogramInfo, forcing redraw') |
---|
786 | # Repaint called while DData window deleted, force redraw of entire window |
---|
787 | import GSASIIdataGUI |
---|
788 | G2frame.PickIdText = '' |
---|
789 | wx.CallLater(100,GSASIIdataGUI.SelectDataTreeItem,G2frame,G2frame.GPXtree.Selection) |
---|
790 | return |
---|
791 | else: |
---|
792 | # deal with case where this is called after another tree item has been selected |
---|
793 | if DData.__class__ is not wx._windows.ScrolledWindow: |
---|
794 | # fix bug where this is called after the Window is deleted |
---|
795 | return |
---|
796 | G2frame.bottomSizer.DeleteWindows() |
---|
797 | Indx.clear() |
---|
798 | G2frame.bottomSizer = ShowHistogramInfo() |
---|
799 | mainSizer.Add(G2frame.bottomSizer) |
---|
800 | mainSizer.Layout() |
---|
801 | G2frame.dataWindow.Refresh() |
---|
802 | DData.SetVirtualSize(mainSizer.GetMinSize()) |
---|
803 | DData.Scroll(0,Scroll) |
---|
804 | G2frame.dataWindow.SendSizeEvent() |
---|
805 | |
---|
806 | def ShowHistogramInfo(): |
---|
807 | '''This creates a sizer with all the information pulled out from the Phase/data dict |
---|
808 | ''' |
---|
809 | |
---|
810 | def OnUseData(event): |
---|
811 | Obj = event.GetEventObject() |
---|
812 | UseList[G2frame.hist]['Use'] = Obj.GetValue() |
---|
813 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
814 | |
---|
815 | def OnLeBail(event): |
---|
816 | Obj = event.GetEventObject() |
---|
817 | if not UseList[G2frame.hist]['LeBail']: |
---|
818 | UseList[G2frame.hist]['newLeBail'] = True |
---|
819 | Obj.SetLabel('Do new LeBail extraction?') |
---|
820 | UseList[G2frame.hist]['LeBail'] = Obj.GetValue() |
---|
821 | |
---|
822 | def OnResetSize(event): |
---|
823 | Obj = event.GetEventObject() |
---|
824 | item,name = Indx[Obj.GetId()] |
---|
825 | if name == 'isotropic': |
---|
826 | UseList[item]['Size'][1][0] = 1.0 |
---|
827 | elif name == 'uniaxial': |
---|
828 | UseList[item]['Size'][1][0] = 1.0 |
---|
829 | UseList[item]['Size'][1][1] = 1.0 |
---|
830 | elif name == 'ellipsoidal': |
---|
831 | for i in range(3): |
---|
832 | UseList[item]['Size'][4][i] = 1.0 |
---|
833 | UseList[item]['Size'][4][i+3] = 0.0 |
---|
834 | G2plt.PlotSizeStrainPO(G2frame,data,item) |
---|
835 | wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) |
---|
836 | |
---|
837 | def OnSizeAxis(event): |
---|
838 | event.Skip() |
---|
839 | Obj = event.GetEventObject() |
---|
840 | Saxis = Obj.GetValue().split() |
---|
841 | try: |
---|
842 | hkl = [int(Saxis[i]) for i in range(3)] |
---|
843 | except (ValueError,IndexError): |
---|
844 | hkl = UseList[G2frame.hist]['Size'][3] |
---|
845 | if not np.any(np.array(hkl)): |
---|
846 | hkl = UseList[G2frame.hist]['Size'][3] |
---|
847 | UseList[G2frame.hist]['Size'][3] = hkl |
---|
848 | h,k,l = hkl |
---|
849 | Obj.SetValue('%3d %3d %3d'%(h,k,l)) |
---|
850 | |
---|
851 | def OnFixVals(event): |
---|
852 | Obj = event.GetEventObject() |
---|
853 | UseList[G2frame.hist]['Fix FXU'] = Obj.GetValue() |
---|
854 | |
---|
855 | if G2frame.hist not in UseList: |
---|
856 | G2frame.ErrorDialog('Missing data error', |
---|
857 | G2frame.hist+' not in GSAS-II data tree') |
---|
858 | return |
---|
859 | #patch |
---|
860 | if 'Use' not in UseList[G2frame.hist]: |
---|
861 | UseList[G2frame.hist]['Use'] = True |
---|
862 | if 'LeBail' not in UseList[G2frame.hist]: |
---|
863 | UseList[G2frame.hist]['LeBail'] = False |
---|
864 | if 'newLeBail' not in UseList[G2frame.hist]: |
---|
865 | UseList[G2frame.hist]['newLeBail'] = True |
---|
866 | if 'Babinet' not in UseList[G2frame.hist]: |
---|
867 | UseList[G2frame.hist]['Babinet'] = {'BabA':[0.0,False],'BabU':[0.0,False]} |
---|
868 | if 'Fix FXU' not in UseList[G2frame.hist]: |
---|
869 | UseList[G2frame.hist]['Fix FXU'] = ' ' |
---|
870 | if 'Flack' not in UseList[G2frame.hist]: |
---|
871 | UseList[G2frame.hist]['Flack'] = [0.0,False] |
---|
872 | if 'Twins' not in UseList[G2frame.hist]: |
---|
873 | UseList[G2frame.hist]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],] |
---|
874 | if 'Layer Disp' not in UseList[G2frame.hist]: |
---|
875 | UseList[G2frame.hist]['Layer Disp'] = [0.0,False] |
---|
876 | #end patch |
---|
877 | bottomSizer = wx.BoxSizer(wx.VERTICAL) |
---|
878 | useBox = wx.BoxSizer(wx.HORIZONTAL) |
---|
879 | useData = wx.CheckBox(DData,wx.ID_ANY,label='Use Histogram: '+G2frame.hist+' ?') |
---|
880 | useData.Bind(wx.EVT_CHECKBOX, OnUseData) |
---|
881 | useData.SetValue(UseList[G2frame.hist]['Use']) |
---|
882 | useBox.Add(useData,0,WACV) |
---|
883 | if not generalData['doPawley'] and 'PWDR' in G2frame.hist[:4]: |
---|
884 | lbLabel = 'Redo LeBail extraction? ' |
---|
885 | if UseList[G2frame.hist]['newLeBail']: |
---|
886 | lbLabel = 'Do new LeBail extraction?' |
---|
887 | lebail = wx.CheckBox(DData,wx.ID_ANY,label=lbLabel) |
---|
888 | lebail.Bind(wx.EVT_CHECKBOX, OnLeBail) |
---|
889 | lebail.SetValue(UseList[G2frame.hist]['LeBail']) |
---|
890 | useBox.Add(lebail,0,WACV) |
---|
891 | if UseList[G2frame.hist]['LeBail']: |
---|
892 | G2frame.SetStatusText('To reset LeBail, cycle LeBail check box.',1) |
---|
893 | bottomSizer.Add(useBox,0,wx.TOP|wx.BOTTOM|wx.LEFT,5) |
---|
894 | fixBox = wx.BoxSizer(wx.HORIZONTAL) |
---|
895 | parmChoice = [' ','X','XU','U','F','FX','FXU','FU'] |
---|
896 | if generalData['Type'] == 'magnetic': |
---|
897 | parmChoice += ['M','MX','MXU','MU','MF','MFX','MFXU','MFU'] |
---|
898 | fixBox.Add(wx.StaticText(DData,label=' In sequential refinement, fix these in '+generalData['Name']+' for this histogram: '),0,WACV) |
---|
899 | fixVals = wx.ComboBox(DData,value=UseList[G2frame.hist]['Fix FXU'],choices=parmChoice, |
---|
900 | style=wx.CB_DROPDOWN) |
---|
901 | fixVals.Bind(wx.EVT_COMBOBOX,OnFixVals) |
---|
902 | fixBox.Add(fixVals,0,WACV) |
---|
903 | bottomSizer.Add(fixBox) |
---|
904 | #TODO - put Sequential refinement fix F? fix X? fix U? CheckBox here |
---|
905 | |
---|
906 | bottomSizer.Add(ScaleSizer(),0,wx.BOTTOM,5) |
---|
907 | |
---|
908 | if G2frame.hist[:4] == 'PWDR': |
---|
909 | if UseList[G2frame.hist]['Size'][0] == 'isotropic': |
---|
910 | isoSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
911 | isoSizer.Add(TopSizer(' Domain size model: ',['isotropic','uniaxial','ellipsoidal'], |
---|
912 | 'Size',OnSizeType),0,WACV) |
---|
913 | isoSizer.Add(LGmixSizer('Size',[0.,1.],OnLGmixRef)) |
---|
914 | isoSizer.Add(ResetSizer('isotropic',OnResetSize),0,WACV) |
---|
915 | bottomSizer.Add(isoSizer) |
---|
916 | bottomSizer.Add(IsoSizer(u'size(\xb5m): ','Size',(10,4),[0.,4.],OnSizeRef),0,wx.BOTTOM,5) |
---|
917 | elif UseList[G2frame.hist]['Size'][0] == 'uniaxial': |
---|
918 | uniSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
919 | uniSizer.Add(TopSizer(' Domain size model: ',['isotropic','uniaxial','ellipsoidal'], |
---|
920 | 'Size',OnSizeType),0,WACV) |
---|
921 | uniSizer.Add(LGmixSizer('Size',[0.,1.],OnLGmixRef)) |
---|
922 | uniSizer.Add(ResetSizer('uniaxial',OnResetSize),0,WACV) |
---|
923 | bottomSizer.Add(UniSizer('Size',OnSizeAxis),0) |
---|
924 | bottomSizer.Add(uniSizer) |
---|
925 | bottomSizer.Add(UniDataSizer(u'size(\xb5m): ','Size',(10,3),[0.,4.],OnSizeRef),0,wx.BOTTOM,5) |
---|
926 | elif UseList[G2frame.hist]['Size'][0] == 'ellipsoidal': |
---|
927 | ellSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
928 | ellSizer.Add(TopSizer(' Domain size model: ',['isotropic','uniaxial','ellipsoidal'], |
---|
929 | 'Size',OnSizeType),0,WACV) |
---|
930 | ellSizer.Add(LGmixSizer('Size',[0.,1.],OnLGmixRef)) |
---|
931 | ellSizer.Add(ResetSizer('ellipsoidal',OnResetSize),0,WACV) |
---|
932 | bottomSizer.Add(ellSizer) |
---|
933 | bottomSizer.Add(EllSizeDataSizer(),0,wx.BOTTOM,5) |
---|
934 | |
---|
935 | if UseList[G2frame.hist]['Mustrain'][0] == 'isotropic': |
---|
936 | isoSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
937 | isoSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',], |
---|
938 | 'Mustrain',OnStrainType),0,WACV) |
---|
939 | isoSizer.Add(LGmixSizer('Mustrain',[0.,1.],OnLGmixRef)) |
---|
940 | isoSizer.Add(ResetSizer('isotropic',OnResetStrain),0,WACV) |
---|
941 | bottomSizer.Add(isoSizer) |
---|
942 | bottomSizer.Add(IsoSizer(' microstrain: ','Mustrain',(10,1),[0.,1.e5],OnStrainRef),0,wx.BOTTOM,5) |
---|
943 | elif UseList[G2frame.hist]['Mustrain'][0] == 'uniaxial': |
---|
944 | uniSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
945 | uniSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',], |
---|
946 | 'Mustrain',OnStrainType),0,WACV) |
---|
947 | uniSizer.Add(LGmixSizer('Mustrain',[0.,1.],OnLGmixRef)) |
---|
948 | uniSizer.Add(ResetSizer('uniaxial',OnResetStrain),0,WACV) |
---|
949 | bottomSizer.Add(uniSizer) |
---|
950 | bottomSizer.Add(UniSizer('Mustrain',OnStrainAxis),0) |
---|
951 | bottomSizer.Add(UniDataSizer('mustrain: ','Mustrain',(10,1),[0.,1.e5],OnStrainRef),0,wx.BOTTOM,5) |
---|
952 | elif UseList[G2frame.hist]['Mustrain'][0] == 'generalized': |
---|
953 | genSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
954 | genSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',], |
---|
955 | 'Mustrain',OnStrainType),0,WACV) |
---|
956 | genSizer.Add(LGmixSizer('Mustrain',[0.,1.],OnLGmixRef)) |
---|
957 | genSizer.Add(ResetSizer('generalized',OnResetStrain),0,WACV) |
---|
958 | bottomSizer.Add(genSizer) |
---|
959 | bottomSizer.Add(GenStrainDataSizer(),0,wx.BOTTOM,5) |
---|
960 | |
---|
961 | bottomSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Hydrostatic/elastic strain:')) |
---|
962 | bottomSizer.Add(HstrainSizer()) |
---|
963 | bottomSizer.Add(DispSizer()) |
---|
964 | |
---|
965 | poSizer = wx.BoxSizer(wx.VERTICAL) |
---|
966 | POData = UseList[G2frame.hist]['Pref.Ori.'] |
---|
967 | # patch - add penalty items |
---|
968 | if len(POData) < 7: |
---|
969 | POData.append(['',]) |
---|
970 | POData.append(0.1) |
---|
971 | if not POData[6]: |
---|
972 | POData[6] = ['',] |
---|
973 | # end patch |
---|
974 | poSizer.Add(PoTopSizer(POData)) |
---|
975 | if POData[0] == 'MD': |
---|
976 | poSizer.Add(MDDataSizer(POData)) |
---|
977 | else: #'SH' |
---|
978 | if POData[4]: #SH order > 0 |
---|
979 | textJ = G2lat.textureIndex(POData[5]) |
---|
980 | poSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Spherical harmonic coefficients: '+'Texture index: %.3f'%(textJ)) |
---|
981 | ,0,wx.TOP|wx.BOTTOM,5) |
---|
982 | poSizer.Add(SHDataSizer(POData),0,wx.TOP|wx.BOTTOM,5) |
---|
983 | poSizer.Add(SHPenalty(POData),0,wx.TOP|wx.BOTTOM,5) |
---|
984 | |
---|
985 | bottomSizer.Add(poSizer,0,wx.TOP|wx.BOTTOM,5) |
---|
986 | bottomSizer.Add(ExtSizer('PWDR'),0,wx.TOP|wx.BOTTOM,5) |
---|
987 | if generalData['Type'] != 'magnetic': |
---|
988 | bottomSizer.Add(BabSizer(),0,wx.BOTTOM,5) |
---|
989 | elif G2frame.hist[:4] == 'HKLF': |
---|
990 | bottomSizer.Add(ExtSizer('HKLF'),0,wx.BOTTOM,5) |
---|
991 | bottomSizer.Add(BabSizer(),0,wx.BOTTOM,5) |
---|
992 | if not SGData['SGInv'] and len(UseList[G2frame.hist]['Twins']) < 2: |
---|
993 | bottomSizer.Add(FlackSizer(),0,wx.BOTTOM,5) |
---|
994 | bottomSizer.Add(twinSizer(),0,wx.BOTTOM,5) |
---|
995 | return bottomSizer |
---|
996 | |
---|
997 | ###################################################################### |
---|
998 | ### Beginning of UpdateDData execution here |
---|
999 | ###################################################################### |
---|
1000 | G2frame.SetStatusText('',1) |
---|
1001 | keyList = G2frame.GetHistogramNames(['PWDR','HKLF']) |
---|
1002 | UseList = data['Histograms'] |
---|
1003 | if UseList: |
---|
1004 | G2frame.dataWindow.DataMenu.Enable(G2G.wxID_DATADELETE,True) |
---|
1005 | for item in G2frame.Refine: item.Enable(True) |
---|
1006 | else: |
---|
1007 | G2frame.dataWindow.DataMenu.Enable(G2G.wxID_DATADELETE,False) |
---|
1008 | for item in G2frame.Refine: item.Enable(False) |
---|
1009 | # make a list of histograms (any type) used in this phase, ordered as in tree |
---|
1010 | G2frame.dataWindow.HistsInPhase = [name for name in keyList if name in UseList] |
---|
1011 | generalData = data['General'] |
---|
1012 | cell = generalData['Cell'][1:] |
---|
1013 | Amat,Bmat = G2lat.cell2AB(cell[:6]) |
---|
1014 | PhaseName = generalData['Name'] |
---|
1015 | SGData = generalData['SGData'] |
---|
1016 | if len(G2frame.dataWindow.HistsInPhase) == 0: # no associated histograms, nothing to display here |
---|
1017 | G2frame.hist = '' |
---|
1018 | elif hist and hist in G2frame.dataWindow.HistsInPhase: # something was input as a selection as an argument |
---|
1019 | G2frame.hist = hist |
---|
1020 | elif (not G2frame.hist) or (G2frame.hist not in G2frame.dataWindow.HistsInPhase): # no or bad selection but have data, take the first |
---|
1021 | G2frame.hist = G2frame.dataWindow.HistsInPhase[0] |
---|
1022 | Indx = {} |
---|
1023 | |
---|
1024 | if DData.GetSizer(): |
---|
1025 | try: |
---|
1026 | if hasattr(DData,'select'): |
---|
1027 | DData.select.Unbind(wx.EVT_LISTBOX) # remove binding to avoid event on Linux |
---|
1028 | except: |
---|
1029 | pass |
---|
1030 | DData.GetSizer().Clear(True) |
---|
1031 | mainSizer = wx.BoxSizer(wx.VERTICAL) |
---|
1032 | topSizer = wx.BoxSizer(wx.HORIZONTAL) |
---|
1033 | topSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Histogram data for '+PhaseName+':'),0,wx.LEFT,5) |
---|
1034 | # add help button to bring up help web page - at right sede of window |
---|
1035 | topSizer.Add((-1,-1),1,wx.EXPAND) |
---|
1036 | topSizer.Add(G2G.HelpButton(DData,helpIndex=G2frame.dataWindow.helpKey)) |
---|
1037 | mainSizer.Add(topSizer,0,wx.EXPAND) |
---|
1038 | if G2frame.hist: |
---|
1039 | topSizer = wx.FlexGridSizer(1,2,5,5) |
---|
1040 | DData.select = wx.ListBox(DData,choices=G2frame.dataWindow.HistsInPhase, |
---|
1041 | style=wx.LB_SINGLE,size=(-1,160)) |
---|
1042 | DData.select.SetSelection(G2frame.dataWindow.HistsInPhase.index(G2frame.hist)) |
---|
1043 | DData.select.SetFirstItem(G2frame.dataWindow.HistsInPhase.index(G2frame.hist)) |
---|
1044 | DData.select.Bind(wx.EVT_LISTBOX,OnSelect) |
---|
1045 | topSizer.Add(DData.select,0,WACV|wx.LEFT,5) |
---|
1046 | if any(['PWDR' in item for item in keyList]): |
---|
1047 | topSizer.Add(PlotSizer()) |
---|
1048 | mainSizer.Add(topSizer) |
---|
1049 | G2frame.bottomSizer = ShowHistogramInfo() |
---|
1050 | mainSizer.Add(G2frame.bottomSizer) |
---|
1051 | elif not keyList: |
---|
1052 | mainSizer.Add(wx.StaticText(DData,wx.ID_ANY, |
---|
1053 | ' (This project has no data; use Import to read it)'),0,wx.TOP,10) |
---|
1054 | elif not UseList in G2frame.dataWindow.HistsInPhase: |
---|
1055 | mainSizer.Add(wx.StaticText(DData,wx.ID_ANY, |
---|
1056 | ' (This phase has no associated data; use appropriate Edit/Add... menu item)'),0,wx.TOP,10) |
---|
1057 | else: |
---|
1058 | mainSizer.Add(wx.StaticText(DData,wx.ID_ANY,' (Strange, how did we get here?)'),0,wx.TOP,10) |
---|
1059 | |
---|
1060 | G2phG.SetPhaseWindow(DData,mainSizer,Scroll=Scroll) |
---|