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