3333Pwrm2 = chr (0x207b )+ chr (0x0b2 )
3434Pwrm6 = chr (0x207b )+ chr (0x2076 )
3535Pwrm4 = chr (0x207b )+ chr (0x2074 )
36- Angstr = chr (0x00c5 )
36+ Angstr = chr (0x00c5 )
3737Gkmu = chr (0x3bc )
3838Pwr3 = chr (0x0b3 )
3939Pwr4 = chr (0x2074 )
4444 wxID_RESULTS ,wxID_SLIDER1 , wxID_SPINBUTTON , wxID_NUMELEM , wxID_SPINTEXT5 ,wxID_SPINTEXT6 ,
4545] = [wx .NewId () for _init_ctrls in range (11 )]
4646
47- [wxID_EXIT , wxID_DELETE , wxID_NEW ,
47+ [wxID_EXIT , wxID_DELETE , wxID_NEW ,
4848] = [wx .NewId () for _init_coll_ABSORB_Items in range (3 )]
49-
50- [wxID_KALPHAAGKA , wxID_KALPHACOKA , wxID_KALPHACRKA ,
51- wxID_KALPHACUKA , wxID_KALPHAFEKA , wxID_KALPHAMNKA ,
49+
50+ [wxID_KALPHAAGKA , wxID_KALPHACOKA , wxID_KALPHACRKA ,
51+ wxID_KALPHACUKA , wxID_KALPHAFEKA , wxID_KALPHAMNKA ,
5252 wxID_KALPHAMOKA , wxID_KALPHANIKA , wxID_KALPHAZNKA ,
53- wxID_KALPHAGAKA ,wxID_KALPHAINKA ,
53+ wxID_KALPHAGAKA ,wxID_KALPHAINKA ,
5454] = [wx .NewId () for _init_coll_KALPHA_Items in range (11 )]
5555
5656[wxID_ABSORBABOUT ] = [wx .NewId () for _init_coll_ABOUT_Items in range (1 )]
@@ -102,37 +102,37 @@ def _init_coll_KALPHA_Items(self, parent):
102102 "Set of characteristic radiation from sealed tube sources"
103103 def OnCrkaMenu (event ):
104104 self .SetWaveEnergy (2.28962 )
105-
105+
106106 def OnMnkaMenu (event ):
107107 self .SetWaveEnergy (2.10174 )
108-
108+
109109 def OnFekaMenu (event ):
110110 self .SetWaveEnergy (1.93597 )
111-
111+
112112 def OnCokaMenu (event ):
113113 self .SetWaveEnergy (1.78896 )
114-
114+
115115 def OnNikaMenu (event ):
116116 self .SetWaveEnergy (1.65784 )
117-
117+
118118 def OnCukaMenu (event ):
119119 self .SetWaveEnergy (1.54052 )
120-
120+
121121 def OnZnkaMenu (event ):
122122 self .SetWaveEnergy (1.43510 )
123-
123+
124124 def OnGakaMenu (event ):
125125 self .SetWaveEnergy (1.34134 )
126-
126+
127127 def OnMokaMenu (event ):
128128 self .SetWaveEnergy (0.70926 )
129-
129+
130130 def OnAgkaMenu (event ):
131131 self .SetWaveEnergy (0.55936 )
132-
132+
133133 def OnInkaMenu (event ):
134134 self .SetWaveEnergy (0.51357 )
135-
135+
136136 parent .Append (wxID_KALPHACRKA , 'CrKa' )
137137 parent .Append (wxID_KALPHAMNKA , 'MnKa' )
138138 parent .Append (wxID_KALPHAFEKA , 'FeKa' )
@@ -164,7 +164,7 @@ def _init_coll_ABSORB_Items(self, parent):
164164 self .Bind (wx .EVT_MENU , self .OnExitMenu , id = wxID_EXIT )
165165 self .Bind (wx .EVT_MENU , self .OnNewMenu , id = wxID_NEW )
166166 self .Bind (wx .EVT_MENU , self .OnDeleteMenu , id = wxID_DELETE )
167-
167+
168168 def _init_utils (self ):
169169 self .ABSORB = wx .Menu (title = '' )
170170
@@ -182,11 +182,11 @@ def _init_utils(self):
182182
183183 def _init_ctrls (self , parent ):
184184 wx .Frame .__init__ (self , parent = parent ,
185- size = wx .Size (500 , 400 ),style = wx .DEFAULT_FRAME_STYLE ^ wx .CLOSE_BOX , title = 'Absorb' )
185+ size = wx .Size (500 , 400 ),style = wx .DEFAULT_FRAME_STYLE ^ wx .CLOSE_BOX , title = 'Absorb' )
186186 self ._init_utils ()
187187 self .SetMenuBar (self .menuBar1 )
188188 self .DrawPanel ()
189-
189+
190190 def SetSize (self ):
191191 w ,h = self .GetClientSize ()
192192 self .panel .SetSize (wx .Size (w ,h ))
@@ -200,7 +200,7 @@ def DrawPanel(self):
200200 self .Results .SetEditable (False )
201201 mainSizer .Add (self .Results ,1 ,wx .EXPAND )
202202 mainSizer .Add ((10 ,15 ),0 )
203-
203+
204204 if self .Elems :
205205 lablSizer = wx .BoxSizer (wx .HORIZONTAL )
206206 lablSizer .Add ((5 ,10 ),0 )
@@ -218,26 +218,26 @@ def DrawPanel(self):
218218 compSizer .Add (numElem ,0 )
219219 numElem .Bind (wx .EVT_TEXT_ENTER , self .OnNumElem , id = wxID_NUMELEM )
220220 mainSizer .Add (compSizer ,0 )
221- mainSizer .Add ((10 ,15 ),0 )
221+ mainSizer .Add ((10 ,15 ),0 )
222222
223223 selSizer = wx .BoxSizer (wx .HORIZONTAL )
224224 selSizer .Add ((5 ,10 ),0 )
225225 selSizer .Add (wx .StaticText (parent = self .panel , label = 'Wavelength:' ),0 ,wx .EXPAND )
226226 selSizer .Add ((5 ,10 ),0 )
227- self .SpinText1 = wx .TextCtrl (id = wxID_SPINTEXT1 , parent = self .panel ,
227+ self .SpinText1 = wx .TextCtrl (id = wxID_SPINTEXT1 , parent = self .panel ,
228228 size = wx .Size (100 ,20 ), value = "%.4f" % (self .Wave ),style = wx .TE_PROCESS_ENTER )
229229 selSizer .Add (self .SpinText1 ,0 )
230230 selSizer .Add ((5 ,10 ),0 )
231231 self .SpinText1 .Bind (wx .EVT_TEXT_ENTER , self .OnSpinText1 , id = wxID_SPINTEXT1 )
232-
232+
233233 selSizer .Add (wx .StaticText (parent = self .panel , label = 'Energy:' ),0 ,wx .EXPAND )
234234 selSizer .Add ((5 ,10 ),0 )
235- self .SpinText2 = wx .TextCtrl (id = wxID_SPINTEXT2 , parent = self .panel ,
236- size = wx .Size (100 ,20 ), value = "%.4f" % (self .Energy ),style = wx .TE_PROCESS_ENTER )
235+ self .SpinText2 = wx .TextCtrl (id = wxID_SPINTEXT2 , parent = self .panel ,
236+ size = wx .Size (100 ,20 ), value = "%.4f" % (self .Energy ),style = wx .TE_PROCESS_ENTER )
237237 selSizer .Add (self .SpinText2 ,0 )
238238 selSizer .Add ((5 ,10 ),0 )
239239 self .SpinText2 .Bind (wx .EVT_TEXT_ENTER , self .OnSpinText2 , id = wxID_SPINTEXT2 )
240-
240+
241241 selSizer .Add (wx .StaticText (parent = self .panel , label = 'Plot scale:' ),0 ,wx .EXPAND )
242242 selSizer .Add ((5 ,10 ),0 )
243243 self .choice1 = wx .ComboBox (id = wxID_CHOICE1 , parent = self .panel , value = 'Wavelength' ,
@@ -247,9 +247,9 @@ def DrawPanel(self):
247247 self .choice1 .Bind (wx .EVT_COMBOBOX , self .OnChoice1 , id = wxID_CHOICE1 )
248248 mainSizer .Add (selSizer ,0 )
249249 mainSizer .Add ((10 ,10 ),0 )
250-
250+
251251 slideSizer = wx .BoxSizer (wx .HORIZONTAL )
252- self .SpinButton = wx .SpinButton (id = wxID_SPINBUTTON , parent = self .panel ,
252+ self .SpinButton = wx .SpinButton (id = wxID_SPINBUTTON , parent = self .panel ,
253253 size = wx .Size (25 ,24 ), style = wx .SP_VERTICAL | wx .SP_ARROW_KEYS )
254254 slideSizer .Add (self .SpinButton )
255255 self .SpinButton .SetRange (- 1 ,1 )
@@ -263,30 +263,30 @@ def DrawPanel(self):
263263 self .slider1 .Bind (wx .EVT_SLIDER , self .OnSlider1 , id = wxID_SLIDER1 )
264264 mainSizer .Add (slideSizer ,0 ,wx .EXPAND )
265265 mainSizer .Add ((10 ,10 ),0 )
266-
266+
267267 cellSizer = wx .BoxSizer (wx .HORIZONTAL )
268268 cellSizer .Add ((5 ,10 ),0 )
269269 cellSizer .Add (wx .StaticText (parent = self .panel , label = 'Volume:' ),0 ,wx .EXPAND )
270270 cellSizer .Add ((5 ,10 ),0 )
271- self .SpinText3 = wx .TextCtrl (id = wxID_SPINTEXT3 , parent = self .panel ,
271+ self .SpinText3 = wx .TextCtrl (id = wxID_SPINTEXT3 , parent = self .panel ,
272272 size = wx .Size (100 ,20 ), value = "%.2f" % (self .Volume ),style = wx .TE_PROCESS_ENTER )
273273 cellSizer .Add (self .SpinText3 ,0 )
274274 cellSizer .Add ((5 ,10 ),0 )
275275 self .SpinText3 .Bind (wx .EVT_TEXT_ENTER , self .OnSpinText3 , id = wxID_SPINTEXT3 )
276-
276+
277277 cellSizer .Add ((5 ,10 ),0 )
278278 cellSizer .Add (wx .StaticText (parent = self .panel , label = 'Z(vol):' ),0 ,wx .EXPAND )
279279 cellSizer .Add ((5 ,10 ),0 )
280- self .SpinText4 = wx .TextCtrl (id = wxID_SPINTEXT4 , parent = self .panel ,
280+ self .SpinText4 = wx .TextCtrl (id = wxID_SPINTEXT4 , parent = self .panel ,
281281 size = wx .Size (50 ,20 ), value = "%d" % (self .Zcell ),style = wx .TE_PROCESS_ENTER )
282282 cellSizer .Add (self .SpinText4 ,0 )
283283 cellSizer .Add ((5 ,10 ),0 )
284284 self .SpinText4 .Bind (wx .EVT_TEXT_ENTER , self .OnSpinText4 , id = wxID_SPINTEXT4 )
285-
285+
286286 cellSizer .Add ((5 ,10 ),0 )
287287 cellSizer .Add (wx .StaticText (parent = self .panel , label = 'Sample R:' ),0 ,wx .EXPAND )
288288 cellSizer .Add ((5 ,10 ),0 )
289- self .SpinText5 = wx .TextCtrl (id = wxID_SPINTEXT5 , parent = self .panel ,
289+ self .SpinText5 = wx .TextCtrl (id = wxID_SPINTEXT5 , parent = self .panel ,
290290 size = wx .Size (50 ,20 ), value = "%.2f" % (self .Radius ),style = wx .TE_PROCESS_ENTER )
291291 cellSizer .Add (self .SpinText5 ,0 )
292292 cellSizer .Add ((5 ,10 ),0 )
@@ -295,7 +295,7 @@ def DrawPanel(self):
295295 cellSizer .Add ((5 ,10 ),0 )
296296 cellSizer .Add (wx .StaticText (parent = self .panel , label = 'packing:' ),0 ,wx .EXPAND )
297297 cellSizer .Add ((5 ,10 ),0 )
298- self .SpinText6 = wx .TextCtrl (id = wxID_SPINTEXT6 , parent = self .panel ,
298+ self .SpinText6 = wx .TextCtrl (id = wxID_SPINTEXT6 , parent = self .panel ,
299299 size = wx .Size (50 ,20 ), value = "%.2f" % (self .Pack ),style = wx .TE_PROCESS_ENTER )
300300 cellSizer .Add (self .SpinText6 ,0 )
301301 cellSizer .Add ((5 ,10 ),0 )
@@ -346,7 +346,7 @@ def OnNewMenu(self, event):
346346 self .DrawPanel ()
347347 self .NewFPPlot = True
348348 self .SetWaveEnergy (self .Wave )
349-
349+
350350 def OnDeleteMenu (self , event ):
351351 if len (self .Elems ):
352352 ElList = []
@@ -367,38 +367,38 @@ def OnDeleteMenu(self, event):
367367 self .ifVol = False
368368 self .NewFPPlot = True
369369 self .SetWaveEnergy (self .Wave )
370-
370+
371371 def OnNumElem (self , event ):
372372 for Elem in self .Elems :
373373 if event .GetEventObject ().GetName () == Elem [0 ]:
374374 Elem [2 ] = float (event .GetEventObject ().GetValue ())
375375 event .GetEventObject ().SetValue ("%8.2f" % (Elem [2 ]))
376376 self .ifVol = False
377- self .SetWaveEnergy (self .Wave )
378-
377+ self .SetWaveEnergy (self .Wave )
378+
379379 def OnSpinText1 (self , event ):
380380 self .SetWaveEnergy (float (self .SpinText1 .GetValue ()))
381-
381+
382382 def OnSpinText2 (self , event ):
383383 self .SetWaveEnergy (self .Kev / (float (self .SpinText2 .GetValue ())))
384-
384+
385385 def OnSpinText3 (self ,event ):
386386 self .Volume = max (10. ,float (self .SpinText3 .GetValue ()))
387387 self .ifVol = True
388388 self .SetWaveEnergy (self .Wave )
389-
389+
390390 def OnSpinText4 (self ,event ):
391391 self .Zcell = max (1 ,float (self .SpinText4 .GetValue ()))
392392 self .SetWaveEnergy (self .Wave )
393-
393+
394394 def OnSpinText5 (self , event ):
395395 self .Radius = max (0.01 ,float (self .SpinText5 .GetValue ()))
396396 self .SetWaveEnergy (self .Wave )
397-
397+
398398 def OnSpinText6 (self , event ):
399399 self .Pack = min (1.0 ,max (0.01 ,float (self .SpinText6 .GetValue ())))
400400 self .SetWaveEnergy (self .Wave )
401-
401+
402402 def OnSpinButton (self , event ):
403403 move = self .SpinButton .GetValue ()/ 10000.
404404 self .Wave = min (max (self .Wave + move ,self .Wmin ),self .Wmax )
@@ -411,7 +411,7 @@ def OnSlider1(self, event):
411411 else :
412412 Wave = self .Kev / (float (self .slider1 .GetValue ())/ 1000. )
413413 self .SetWaveEnergy (Wave )
414-
414+
415415 def SetWaveEnergy (self ,Wave ):
416416 self .Wave = Wave
417417 self .Energy = self .Kev / self .Wave
@@ -460,23 +460,23 @@ def SetWaveEnergy(self,Wave):
460460 'Element: ' + str (Els ),"N = " ,Elem [2 ]," f'=" ,(r1 [0 ]+ r2 [0 ])/ 2.0 ,
461461 ' f"=' ,(r1 [1 ]+ r2 [1 ])/ 2.0 ,' ' + Gkmu + '=' ,mu ,'barns' )
462462 muT += mu
463-
463+
464464 if self .Volume :
465465 Text += "%s %s%10.4g %s" % ("Total" ,' ' + Gkmu + ' =' ,self .Pack * muT / self .Volume ,'cm' + Pwrm1 + ', ' )
466466 Text += "%s%10.4g%s" % ('Total ' + Gkmu + 'R =' ,self .Radius * self .Pack * muT / (10.0 * self .Volume ),', ' )
467467 Text += "%s%10.4f%s\n " % ('Transmission exp(-2' + Gkmu + 'R) =' , \
468468 100.0 * math .exp (- 2. * self .Radius * self .Pack * muT / (10.0 * self .Volume )),'%' )
469469 if muT > 0. :
470470 pene = 10. / (self .Pack * muT / self .Volume )
471- if pene > 0.01 :
471+ if pene > 0.01 :
472472 Text += "%s %10.4g mm\n " % ("1/e (~27.2%) penetration depth = " ,pene )
473473 else :
474474 Text += "%s %10.4g %sm\n " % ("1/e (~27.2%) penetration depth = " ,1000.0 * pene ,Gkmu )
475475 self .Results .SetValue (Text )
476- den = Mass / (0.602 * self .Volume )
476+ den = Mass / (0.602 * self .Volume )
477477 if self .ifVol :
478478 Text += '%s' % ('Theor. density =' )
479- else :
479+ else :
480480 Text += '%s' % ('Est. density =' )
481481 Text += '%6.3f %s%.3f %s\n ' % (den ,'g/cm' + Pwr3 + ', Powder density =' ,self .Pack * den ,'g/cm' + Pwr3 )
482482 Text += '%s%10.2f%s\n ' % ('X-ray small angle scattering contrast' ,(28.179 * Fo / self .Volume )** 2 ,'*10' + Pwr20 + '/cm' + Pwr4 )
@@ -566,7 +566,7 @@ def OnChoice1(self, event):
566566 if len (self .Elems ):
567567 self .CalcFPPS ()
568568 self .UpDateAbsPlot (self .Wave ,rePlot = False )
569-
569+
570570 def OnKeyPress (self ,event ):
571571 if event .key == 'g' :
572572 mpl .rcParams ['axes.grid' ] = not mpl .rcParams ['axes.grid' ]
@@ -590,20 +590,20 @@ def UpDateAbsPlot(self,Wave,rePlot=True):
590590 self .ax = self .Page .figure .add_subplot (111 ,label = 'absorb' )
591591 self .fplot .set_visible (False )
592592 self .Page .Choice = (' key press' ,'g: toggle grid' ,)
593- self .Page .keyPress = self .OnKeyPress
593+ self .Page .keyPress = self .OnKeyPress
594594 self .ax .clear ()
595595 self .ax .set_title ('X-Ray Absorption' ,x = 0 ,ha = 'left' )
596596 self .ax .set_ylabel (r"$\mu R$" ,fontsize = 14 )
597597 Ymin = 0.0
598598 Ymax = 0.0
599- if self .FPPS :
599+ if self .FPPS :
600600 for Fpps in self .FPPS :
601601 Ymin = min (Ymin ,min (Fpps [2 ]))
602602 Ymax = max (Ymax ,max (Fpps [2 ]))
603603 fppsP1 = np .array (Fpps [1 ])
604604 fppsP2 = np .array (Fpps [2 ])
605605 self .ax .plot (fppsP1 ,fppsP2 ,label = r'$\mu R$ ' + Fpps [0 ])
606- if self .ifWave :
606+ if self .ifWave :
607607 self .ax .set_xlabel (r'$\mathsf{\lambda, \AA}$' ,fontsize = 14 )
608608 self .ax .axvline (x = Wave ,picker = 3 ,color = 'black' )
609609 else :
@@ -627,10 +627,10 @@ def UpDateAbsPlot(self,Wave,rePlot=True):
627627 xylim = []
628628 tb .push_current ()
629629 self .Page .canvas .draw ()
630-
630+
631631 def OnPick (self , event ):
632632 self .linePicked = event .artist
633-
633+
634634 def OnMotion (self ,event ):
635635 xpos = event .xdata
636636 if xpos and xpos > 0.1 :
@@ -643,7 +643,7 @@ def OnMotion(self,event):
643643 self .parent .G2plotNB .status .SetStatusText ('Wavelength: %.4f, Energy: %.3f, %sR: %.3f' % (Wave ,self .Kev / Wave ,Gkmu ,ypos ),1 )
644644 if self .linePicked :
645645 self .SetWaveEnergy (Wave )
646-
646+
647647 def OnRelease (self , event ):
648648 if self .linePicked is None : return
649649 self .linePicked = None
@@ -652,9 +652,9 @@ def OnRelease(self, event):
652652 if self .ifWave :
653653 Wave = xpos
654654 else :
655- Wave = self .Kev / xpos
655+ Wave = self .Kev / xpos
656656 self .SetWaveEnergy (Wave )
657-
657+
658658 def OnABOUTItems0Menu (self , event ):
659659 '''Displays the About window
660660 '''
@@ -667,19 +667,19 @@ def OnABOUTItems0Menu(self, event):
667667 info .Copyright = '''
668668Robert B. Von Dreele, 2009(C)
669669Argonne National Laboratory
670- This product includes software developed
671- by the UChicago Argonne, LLC, as
670+ This product includes software developed
671+ by the UChicago Argonne, LLC, as
672672Operator of Argonne National Laboratory. '''
673673 info .Description = '''
674- For calculating X-ray absorption factors to 250keV for cylindrical
675- powder samples; based on Fortran program Fprime of Cromer & Liberman
674+ For calculating X-ray absorption factors to 250keV for cylindrical
675+ powder samples; based on Fortran program Fprime of Cromer & Liberman
676676(D. T. Cromer and D. A. Liberman, Acta Cryst. (1981). A37, 267-268.)
677677corrected for Kissel & Pratt energy term; Jensen term not included
678678 '''
679679 wxadv .AboutBox (info )
680680
681681if __name__ == "__main__" :
682- import GSASIIplot as G2plt
682+ from . import GSASIIplot as G2plt
683683 app = wx .App ()
684684 GSASIIpath .InvokeDebugOpts ()
685685 frm = wx .Frame (None ) # create a frame
0 commit comments