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