source: trunk/sphinxdocs/build/html/_modules/GSASIIddataGUI.html @ 1168

Last change on this file since 1168 was 1168, checked in by toby, 9 years ago

update imports to provide error messages

  • Property svn:mime-type set to text/html
File size: 237.2 KB
Line 
1
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6
7<html xmlns="http://www.w3.org/1999/xhtml">
8  <head>
9    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10   
11    <title>GSASIIddataGUI &mdash; GSAS-II 0.2.0 documentation</title>
12   
13    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
14    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
15   
16    <script type="text/javascript">
17      var DOCUMENTATION_OPTIONS = {
18        URL_ROOT:    '../',
19        VERSION:     '0.2.0',
20        COLLAPSE_INDEX: false,
21        FILE_SUFFIX: '.html',
22        HAS_SOURCE:  true
23      };
24    </script>
25    <script type="text/javascript" src="../_static/jquery.js"></script>
26    <script type="text/javascript" src="../_static/underscore.js"></script>
27    <script type="text/javascript" src="../_static/doctools.js"></script>
28    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
29    <link rel="top" title="GSAS-II 0.2.0 documentation" href="../index.html" />
30    <link rel="up" title="Module code" href="index.html" /> 
31  </head>
32  <body>
33    <div class="related">
34      <h3>Navigation</h3>
35      <ul>
36        <li class="right" style="margin-right: 10px">
37          <a href="../genindex.html" title="General Index"
38             accesskey="I">index</a></li>
39        <li class="right" >
40          <a href="../py-modindex.html" title="Python Module Index"
41             >modules</a> |</li>
42        <li><a href="../index.html">GSAS-II 0.2.0 documentation</a> &raquo;</li>
43          <li><a href="index.html" accesskey="U">Module code</a> &raquo;</li> 
44      </ul>
45    </div> 
46
47    <div class="document">
48      <div class="documentwrapper">
49        <div class="bodywrapper">
50          <div class="body">
51           
52  <h1>Source code for GSASIIddataGUI</h1><div class="highlight"><pre>
53<span class="c"># -*- coding: utf-8 -*-</span>
54<span class="c">#GSASII - phase data display routines</span>
55<span class="c">########### SVN repository information ###################</span>
56<span class="c"># $Date: 2013-10-03 13:11:47 -0500 (Thu, 03 Oct 2013) $</span>
57<span class="c"># $Author: toby $</span>
58<span class="c"># $Revision: 1077 $</span>
59<span class="c"># $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/GSASIIddataGUI.py $</span>
60<span class="c"># $Id: GSASIIddataGUI.py 1077 2013-10-03 18:11:47Z toby $</span>
61<span class="c">########### SVN repository information ###################</span>
62<span class="sd">&#39;&#39;&#39;</span>
63<span class="sd">*GSASIIddataGUI: Phase Diffraction Data GUI*</span>
64<span class="sd">--------------------------------------------</span>
65
66<span class="sd">Module to create the GUI for display of diffraction data * phase</span>
67<span class="sd">information that is shown in the data display window</span>
68<span class="sd">(when a phase is selected.)</span>
69
70<span class="sd">&#39;&#39;&#39;</span>
71<span class="kn">import</span> <span class="nn">wx</span>
72<span class="kn">import</span> <span class="nn">math</span>
73<span class="kn">import</span> <span class="nn">copy</span>
74<span class="kn">import</span> <span class="nn">time</span>
75<span class="kn">import</span> <span class="nn">sys</span>
76<span class="kn">import</span> <span class="nn">GSASIIpath</span>
77<span class="n">GSASIIpath</span><span class="o">.</span><span class="n">SetVersionNumber</span><span class="p">(</span><span class="s">&quot;$Revision: 1077 $&quot;</span><span class="p">)</span>
78<span class="kn">import</span> <span class="nn">GSASIIlattice</span> <span class="kn">as</span> <span class="nn">G2lat</span>
79<span class="kn">import</span> <span class="nn">GSASIIspc</span> <span class="kn">as</span> <span class="nn">G2spc</span>
80<span class="kn">import</span> <span class="nn">GSASIIElem</span> <span class="kn">as</span> <span class="nn">G2elem</span>
81<span class="kn">import</span> <span class="nn">GSASIIElemGUI</span> <span class="kn">as</span> <span class="nn">G2elemGUI</span>
82<span class="kn">import</span> <span class="nn">GSASIIplot</span> <span class="kn">as</span> <span class="nn">G2plt</span>
83<span class="kn">import</span> <span class="nn">GSASIIgrid</span> <span class="kn">as</span> <span class="nn">G2gd</span>
84<span class="kn">import</span> <span class="nn">GSASIIIO</span> <span class="kn">as</span> <span class="nn">G2IO</span>
85<span class="kn">import</span> <span class="nn">GSASIImath</span> <span class="kn">as</span> <span class="nn">G2mth</span>
86<span class="kn">import</span> <span class="nn">GSASIIpwd</span> <span class="kn">as</span> <span class="nn">G2pwd</span>
87<span class="kn">import</span> <span class="nn">GSASIIphsGUI</span> <span class="kn">as</span> <span class="nn">G2phsGUI</span>
88<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
89
90<span class="n">VERY_LIGHT_GREY</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Colour</span><span class="p">(</span><span class="mi">235</span><span class="p">,</span><span class="mi">235</span><span class="p">,</span><span class="mi">235</span><span class="p">)</span>
91<span class="n">WHITE</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Colour</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">255</span><span class="p">)</span>
92<span class="n">BLACK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Colour</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
93<span class="n">mapDefault</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;MapType&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">,</span><span class="s">&#39;RefList&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">,</span><span class="s">&#39;Resolution&#39;</span><span class="p">:</span><span class="mf">0.5</span><span class="p">,</span><span class="s">&#39;Show bonds&#39;</span><span class="p">:</span><span class="bp">True</span><span class="p">,</span>
94                <span class="s">&#39;rho&#39;</span><span class="p">:[],</span><span class="s">&#39;rhoMax&#39;</span><span class="p">:</span><span class="mf">0.</span><span class="p">,</span><span class="s">&#39;mapSize&#39;</span><span class="p">:</span><span class="mf">10.0</span><span class="p">,</span><span class="s">&#39;cutOff&#39;</span><span class="p">:</span><span class="mf">50.</span><span class="p">,</span><span class="s">&#39;Flip&#39;</span><span class="p">:</span><span class="bp">False</span><span class="p">}</span>
95
96<span class="c">################################################################################</span>
97<span class="c">##### DData routines</span>
98<span class="c">################################################################################        </span>
99<div class="viewcode-block" id="UpdateDData"><a class="viewcode-back" href="../GSASIIGUI.html#GSASIIddataGUI.UpdateDData">[docs]</a><span class="k">def</span> <span class="nf">UpdateDData</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">):</span>
100    <span class="sd">&#39;&#39;&#39;Display the Diffraction Data associated with a phase</span>
101<span class="sd">    (items where there is a value for each histogram and phase)</span>
102
103<span class="sd">    :param wx.frame G2frame: the main GSAS-II frame object</span>
104
105<span class="sd">    :param wx.ScrolledWindow DData: notebook page to be used for the display</span>
106
107<span class="sd">    :param dict data: all the information on the phase in a dictionary</span>
108
109<span class="sd">    &#39;&#39;&#39;</span>
110    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
111    <span class="n">UseList</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Histograms&#39;</span><span class="p">]</span>
112    <span class="k">if</span> <span class="n">UseList</span><span class="p">:</span>
113        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">DataMenu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_DATADELETE</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span>
114        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">Refine</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
115    <span class="k">else</span><span class="p">:</span>
116        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">DataMenu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_DATADELETE</span><span class="p">,</span><span class="bp">False</span><span class="p">)</span>
117        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">Refine</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
118    <span class="n">generalData</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;General&#39;</span><span class="p">]</span>
119    <span class="n">PhaseName</span> <span class="o">=</span> <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;Name&#39;</span><span class="p">]</span>       
120    <span class="n">SGData</span> <span class="o">=</span> <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;SGData&#39;</span><span class="p">]</span>
121    <span class="n">keyList</span> <span class="o">=</span> <span class="n">UseList</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
122    <span class="n">keyList</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
123    <span class="n">PWDR</span> <span class="o">=</span> <span class="nb">any</span><span class="p">([</span><span class="s">&#39;PWDR&#39;</span> <span class="ow">in</span> <span class="n">item</span> <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">keyList</span><span class="p">])</span>
124    <span class="n">Indx</span> <span class="o">=</span> <span class="p">{}</span>
125   
126    <span class="k">def</span> <span class="nf">PlotSizer</span><span class="p">():</span>
127
128        <span class="k">def</span> <span class="nf">OnPlotSel</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
129            <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
130            <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;Data plot type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span>
131            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
132            <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
133           
134        <span class="k">def</span> <span class="nf">OnPOhkl</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
135            <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
136            <span class="n">Saxis</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
137            <span class="k">try</span><span class="p">:</span>
138                <span class="n">hkl</span> <span class="o">=</span> <span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">Saxis</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">)]</span>
139            <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span><span class="ne">IndexError</span><span class="p">):</span>
140                <span class="n">hkl</span> <span class="o">=</span> <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;POhkl&#39;</span><span class="p">]</span>
141            <span class="k">if</span> <span class="ow">not</span> <span class="n">np</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">hkl</span><span class="p">)):</span>
142                <span class="n">hkl</span> <span class="o">=</span> <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;POhkl&#39;</span><span class="p">]</span>
143            <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;POhkl&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">hkl</span>
144            <span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span> <span class="o">=</span> <span class="n">hkl</span>
145            <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span><span class="p">))</span> 
146            <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
147       
148        <span class="n">plotSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
149        <span class="n">choice</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;None&#39;</span><span class="p">,</span><span class="s">&#39;Mustrain&#39;</span><span class="p">,</span><span class="s">&#39;Size&#39;</span><span class="p">,</span><span class="s">&#39;Preferred orientation&#39;</span><span class="p">]</span>
150        <span class="n">plotSel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioBox</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Select plot type:&#39;</span><span class="p">,</span><span class="n">choices</span><span class="o">=</span><span class="n">choice</span><span class="p">,</span>
151            <span class="n">majorDimension</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span><span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RA_SPECIFY_COLS</span><span class="p">)</span>
152        <span class="n">plotSel</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="n">generalData</span><span class="p">[</span><span class="s">&#39;Data plot type&#39;</span><span class="p">])</span>
153        <span class="n">plotSel</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_RADIOBOX</span><span class="p">,</span><span class="n">OnPlotSel</span><span class="p">)</span>   
154        <span class="n">plotSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">plotSel</span><span class="p">)</span>
155        <span class="k">if</span> <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;Data plot type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;Preferred orientation&#39;</span><span class="p">:</span>
156            <span class="n">POhklSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
157            <span class="n">POhklSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39; Plot preferred orientation for H K L: &#39;</span><span class="p">),</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
158            <span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span> <span class="o">=</span> <span class="n">generalData</span><span class="p">[</span><span class="s">&#39;POhkl&#39;</span><span class="p">]</span>
159            <span class="n">poAxis</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span><span class="p">),</span><span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
160            <span class="n">poAxis</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT_ENTER</span><span class="p">,</span><span class="n">OnPOhkl</span><span class="p">)</span>
161            <span class="n">poAxis</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_KILL_FOCUS</span><span class="p">,</span><span class="n">OnPOhkl</span><span class="p">)</span>
162            <span class="n">POhklSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">poAxis</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
163            <span class="n">plotSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">POhklSizer</span><span class="p">)</span>           
164        <span class="k">return</span> <span class="n">plotSizer</span>
165       
166    <span class="k">def</span> <span class="nf">ScaleSizer</span><span class="p">():</span>
167       
168        <span class="k">def</span> <span class="nf">OnScaleRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
169            <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
170            <span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
171           
172        <span class="k">def</span> <span class="nf">OnScaleVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
173            <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
174            <span class="k">try</span><span class="p">:</span>
175                <span class="n">scale</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
176                <span class="k">if</span> <span class="n">scale</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
177                    <span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">scale</span>
178            <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
179                <span class="k">pass</span>
180            <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.4f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
181                       
182        <span class="n">scaleSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
183        <span class="k">if</span> <span class="s">&#39;PWDR&#39;</span> <span class="ow">in</span> <span class="n">item</span><span class="p">:</span>
184            <span class="n">scaleRef</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">CheckBox</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; Phase fraction: &#39;</span><span class="p">)</span>
185        <span class="k">elif</span> <span class="s">&#39;HKLF&#39;</span> <span class="ow">in</span> <span class="n">item</span><span class="p">:</span>
186            <span class="n">scaleRef</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">CheckBox</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; Scale factor: &#39;</span><span class="p">)</span>               
187        <span class="n">scaleRef</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
188        <span class="n">Indx</span><span class="p">[</span><span class="n">scaleRef</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span> <span class="o">=</span> <span class="n">item</span>
189        <span class="n">scaleRef</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_CHECKBOX</span><span class="p">,</span> <span class="n">OnScaleRef</span><span class="p">)</span>
190        <span class="n">scaleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">scaleRef</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
191        <span class="n">scaleVal</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span>
192            <span class="s">&#39;</span><span class="si">%.4f</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]),</span><span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
193        <span class="n">Indx</span><span class="p">[</span><span class="n">scaleVal</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span> <span class="o">=</span> <span class="n">item</span>
194        <span class="n">scaleVal</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT_ENTER</span><span class="p">,</span><span class="n">OnScaleVal</span><span class="p">)</span>
195        <span class="n">scaleVal</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_KILL_FOCUS</span><span class="p">,</span><span class="n">OnScaleVal</span><span class="p">)</span>
196        <span class="n">scaleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">scaleVal</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
197        <span class="k">return</span> <span class="n">scaleSizer</span>
198       
199    <span class="k">def</span> <span class="nf">OnUseData</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
200        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
201        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
202        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Use&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
203       
204    <span class="k">def</span> <span class="nf">OnShowData</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
205        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
206        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
207        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Show&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
208        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
209        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
210       
211    <span class="k">def</span> <span class="nf">OnCopyData</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
212        <span class="c">#how about HKLF data? This is only for PWDR data</span>
213        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
214        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
215        <span class="n">sourceDict</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">]</span>
216        <span class="n">copyNames</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">,</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">,</span><span class="s">&#39;Size&#39;</span><span class="p">,</span><span class="s">&#39;Mustrain&#39;</span><span class="p">,</span><span class="s">&#39;HStrain&#39;</span><span class="p">,</span><span class="s">&#39;Extinction&#39;</span><span class="p">,</span><span class="s">&#39;Babinet&#39;</span><span class="p">]</span>
217        <span class="n">copyDict</span> <span class="o">=</span> <span class="p">{}</span>
218        <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">copyNames</span><span class="p">:</span> 
219            <span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">])</span>        <span class="c">#force copy</span>
220        <span class="n">keyList</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;All&#39;</span><span class="p">,]</span><span class="o">+</span><span class="n">UseList</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
221        <span class="k">if</span> <span class="n">UseList</span><span class="p">:</span>
222            <span class="n">copyList</span> <span class="o">=</span> <span class="p">[]</span>
223            <span class="n">dlg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MultiChoiceDialog</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> 
224                <span class="s">&#39;Copy parameters to which histograms?&#39;</span><span class="p">,</span> <span class="s">&#39;Copy parameters&#39;</span><span class="p">,</span> 
225                <span class="n">keyList</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">CHOICEDLG_STYLE</span><span class="p">)</span>
226            <span class="k">try</span><span class="p">:</span>
227                <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
228                    <span class="n">result</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetSelections</span><span class="p">()</span>
229                    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span> 
230                        <span class="n">copyList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">keyList</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
231                    <span class="k">if</span> <span class="s">&#39;All&#39;</span> <span class="ow">in</span> <span class="n">copyList</span><span class="p">:</span> 
232                        <span class="n">copyList</span> <span class="o">=</span> <span class="n">keyList</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
233                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">copyList</span><span class="p">:</span>
234                        <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">))</span>
235                    <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
236            <span class="k">finally</span><span class="p">:</span>
237                <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
238               
239    <span class="k">def</span> <span class="nf">OnCopyFlags</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
240        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
241        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
242        <span class="n">sourceDict</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">]</span>
243        <span class="n">copyDict</span> <span class="o">=</span> <span class="p">{}</span>
244        <span class="n">copyNames</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">,</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">,</span><span class="s">&#39;Size&#39;</span><span class="p">,</span><span class="s">&#39;Mustrain&#39;</span><span class="p">,</span><span class="s">&#39;HStrain&#39;</span><span class="p">,</span><span class="s">&#39;Extinction&#39;</span><span class="p">,</span><span class="s">&#39;Babinet&#39;</span><span class="p">]</span>
245        <span class="n">babNames</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;BabA&#39;</span><span class="p">,</span><span class="s">&#39;BabU&#39;</span><span class="p">]</span>
246        <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">copyNames</span><span class="p">:</span>
247            <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">,</span><span class="s">&#39;Extinction&#39;</span><span class="p">,</span><span class="s">&#39;HStrain&#39;</span><span class="p">]:</span>
248                <span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
249            <span class="k">elif</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;Size&#39;</span><span class="p">,</span><span class="s">&#39;Mustrain&#39;</span><span class="p">]:</span>
250                <span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">],</span><span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">4</span><span class="p">]]</span>
251            <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;Pref.Ori.&#39;</span><span class="p">:</span>
252                <span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">]]</span>
253                <span class="k">if</span> <span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;SH&#39;</span><span class="p">:</span>
254                    <span class="n">SHterms</span> <span class="o">=</span> <span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">5</span><span class="p">]</span>
255                    <span class="n">SHflags</span> <span class="o">=</span> <span class="p">{}</span>
256                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">SHterms</span><span class="p">:</span>
257                        <span class="n">SHflags</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="n">SHterms</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
258                    <span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SHflags</span><span class="p">)</span>
259            <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;Babinet&#39;</span><span class="p">:</span>
260                <span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
261                <span class="k">for</span> <span class="n">bab</span> <span class="ow">in</span> <span class="n">babNames</span><span class="p">:</span>
262                    <span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="n">bab</span><span class="p">]</span> <span class="o">=</span> <span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="n">bab</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>                       
263        <span class="n">keyList</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;All&#39;</span><span class="p">,]</span><span class="o">+</span><span class="n">UseList</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
264        <span class="k">if</span> <span class="n">UseList</span><span class="p">:</span>
265            <span class="n">copyList</span> <span class="o">=</span> <span class="p">[]</span>
266            <span class="n">dlg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MultiChoiceDialog</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> 
267                <span class="s">&#39;Copy parameters to which histograms?&#39;</span><span class="p">,</span> <span class="s">&#39;Copy parameters&#39;</span><span class="p">,</span> 
268                <span class="n">keyList</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">CHOICEDLG_STYLE</span><span class="p">)</span>
269            <span class="k">try</span><span class="p">:</span>
270                <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
271                    <span class="n">result</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetSelections</span><span class="p">()</span>
272                    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span> 
273                        <span class="n">copyList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">keyList</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
274                    <span class="k">if</span> <span class="s">&#39;All&#39;</span> <span class="ow">in</span> <span class="n">copyList</span><span class="p">:</span> 
275                        <span class="n">copyList</span> <span class="o">=</span> <span class="n">keyList</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
276                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">copyList</span><span class="p">:</span>
277                        <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>                           
278                        <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">copyNames</span><span class="p">:</span>
279                            <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">,</span><span class="s">&#39;Extinction&#39;</span><span class="p">,</span><span class="s">&#39;HStrain&#39;</span><span class="p">]:</span>
280                                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">])</span>
281                            <span class="k">elif</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;Size&#39;</span><span class="p">,</span><span class="s">&#39;Mustrain&#39;</span><span class="p">]:</span>
282                                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
283                                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
284                                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">])</span>
285                            <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;Pref.Ori.&#39;</span><span class="p">:</span>
286                                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
287                                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
288                                <span class="k">if</span> <span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;SH&#39;</span><span class="p">:</span>
289                                    <span class="n">SHflags</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">])</span>
290                                    <span class="n">SHterms</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">sourceDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">5</span><span class="p">])</span>
291                                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">SHflags</span><span class="p">:</span>
292                                        <span class="n">SHterms</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">SHflags</span><span class="p">[</span><span class="n">item</span><span class="p">])</span>
293                            <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;Babinet&#39;</span><span class="p">:</span>
294                                <span class="k">for</span> <span class="n">bab</span> <span class="ow">in</span> <span class="n">babNames</span><span class="p">:</span>
295                                    <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="n">bab</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">copyDict</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="n">bab</span><span class="p">])</span>                                             
296                    <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
297            <span class="k">finally</span><span class="p">:</span>
298                <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
299       
300       
301    <span class="k">def</span> <span class="nf">OnLGmixRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
302        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
303        <span class="n">hist</span><span class="p">,</span><span class="n">name</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
304        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
305       
306    <span class="k">def</span> <span class="nf">OnLGmixVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
307        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
308        <span class="n">hist</span><span class="p">,</span><span class="n">name</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
309        <span class="k">try</span><span class="p">:</span>
310            <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
311            <span class="k">if</span> <span class="mf">0.1</span> <span class="o">&lt;=</span> <span class="n">value</span> <span class="o">&lt;=</span> <span class="mi">1</span><span class="p">:</span>
312                <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
313            <span class="k">else</span><span class="p">:</span>
314                <span class="k">raise</span> <span class="ne">ValueError</span>
315        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
316            <span class="k">pass</span>
317        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.4f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">2</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
318
319    <span class="k">def</span> <span class="nf">OnSizeType</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
320        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
321        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
322        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
323        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
324        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
325       
326    <span class="k">def</span> <span class="nf">OnSizeRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
327        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
328        <span class="n">hist</span><span class="p">,</span><span class="n">pid</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
329        <span class="k">if</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;ellipsoidal&#39;</span><span class="p">:</span>
330            <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">5</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>               
331        <span class="k">else</span><span class="p">:</span>
332            <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
333       
334    <span class="k">def</span> <span class="nf">OnSizeVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
335        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
336        <span class="n">hist</span><span class="p">,</span><span class="n">pid</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
337        <span class="k">if</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;ellipsoidal&#39;</span><span class="p">:</span>
338            <span class="k">try</span><span class="p">:</span>
339                <span class="n">size</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
340                <span class="k">if</span> <span class="n">pid</span> <span class="o">&lt;</span> <span class="mi">3</span> <span class="ow">and</span> <span class="n">size</span> <span class="o">&lt;=</span> <span class="mf">0.001</span><span class="p">:</span>            <span class="c">#10A lower limit!</span>
341                    <span class="k">raise</span> <span class="ne">ValueError</span>
342                <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>                   
343            <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
344                <span class="k">pass</span>
345            <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.5f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">][</span><span class="n">pid</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
346        <span class="k">else</span><span class="p">:</span>
347            <span class="k">try</span><span class="p">:</span>
348                <span class="n">size</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
349                <span class="k">if</span> <span class="n">size</span> <span class="o">&lt;=</span> <span class="mf">0.001</span><span class="p">:</span>            <span class="c">#10A lower limit!</span>
350                    <span class="k">raise</span> <span class="ne">ValueError</span>
351                <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>
352            <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
353                <span class="k">pass</span>
354            <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.5f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="n">pid</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
355        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
356       
357    <span class="k">def</span> <span class="nf">OnSizeAxis</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>           
358        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
359        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
360        <span class="n">Saxis</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
361        <span class="k">try</span><span class="p">:</span>
362            <span class="n">hkl</span> <span class="o">=</span> <span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">Saxis</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">)]</span>
363        <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span><span class="ne">IndexError</span><span class="p">):</span>
364            <span class="n">hkl</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span>
365        <span class="k">if</span> <span class="ow">not</span> <span class="n">np</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">hkl</span><span class="p">)):</span>
366            <span class="n">hkl</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span>
367        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span> <span class="o">=</span> <span class="n">hkl</span>
368        <span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span> <span class="o">=</span> <span class="n">hkl</span>
369        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span><span class="p">))</span> 
370                   
371    <span class="k">def</span> <span class="nf">OnResetSize</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
372        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
373        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
374        <span class="n">item</span><span class="p">,</span><span class="n">name</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
375        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;isotropic&#39;</span><span class="p">:</span>
376            <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
377        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;uniaxial&#39;</span><span class="p">:</span>
378            <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
379            <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
380        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;ellipsoidal&#39;</span><span class="p">:</span>
381            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
382                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
383                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Size&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">][</span><span class="n">i</span><span class="o">+</span><span class="mi">3</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>
384        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
385        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
386           
387    <span class="k">def</span> <span class="nf">OnStrainType</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
388        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
389        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
390        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
391        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
392        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
393       
394    <span class="k">def</span> <span class="nf">OnStrainRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
395        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
396        <span class="n">hist</span><span class="p">,</span><span class="n">pid</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
397        <span class="k">if</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;generalized&#39;</span><span class="p">:</span>
398            <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">5</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
399        <span class="k">else</span><span class="p">:</span>
400            <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
401       
402    <span class="k">def</span> <span class="nf">OnStrainVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
403        <span class="n">Snames</span> <span class="o">=</span> <span class="n">G2spc</span><span class="o">.</span><span class="n">MustrainNames</span><span class="p">(</span><span class="n">SGData</span><span class="p">)</span>
404        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
405        <span class="n">hist</span><span class="p">,</span><span class="n">pid</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
406        <span class="k">try</span><span class="p">:</span>
407            <span class="n">strain</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
408            <span class="k">if</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;generalized&#39;</span><span class="p">:</span>
409                <span class="k">if</span> <span class="s">&#39;4&#39;</span> <span class="ow">in</span> <span class="n">Snames</span><span class="p">[</span><span class="n">pid</span><span class="p">]</span> <span class="ow">and</span> <span class="n">strain</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
410                    <span class="k">raise</span> <span class="ne">ValueError</span>
411                <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">strain</span>
412            <span class="k">else</span><span class="p">:</span>
413                <span class="k">if</span> <span class="n">strain</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
414                    <span class="k">raise</span> <span class="ne">ValueError</span>
415                <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">strain</span>
416        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
417            <span class="k">pass</span>
418        <span class="k">if</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;generalized&#39;</span><span class="p">:</span>
419            <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.3f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">][</span><span class="n">pid</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
420        <span class="k">else</span><span class="p">:</span>
421            <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.1f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="n">pid</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
422        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
423       
424    <span class="k">def</span> <span class="nf">OnStrainAxis</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
425        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
426        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
427        <span class="n">Saxis</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
428        <span class="k">try</span><span class="p">:</span>
429            <span class="n">hkl</span> <span class="o">=</span> <span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">Saxis</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">)]</span>
430        <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span><span class="ne">IndexError</span><span class="p">):</span>
431            <span class="n">hkl</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span>
432        <span class="k">if</span> <span class="ow">not</span> <span class="n">np</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">hkl</span><span class="p">)):</span>
433            <span class="n">hkl</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span>
434        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span> <span class="o">=</span> <span class="n">hkl</span>
435        <span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span> <span class="o">=</span> <span class="n">hkl</span>
436        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span><span class="p">))</span> 
437        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
438       
439    <span class="k">def</span> <span class="nf">OnResetStrain</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
440        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
441        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
442        <span class="n">item</span><span class="p">,</span><span class="n">name</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
443        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;isotropic&#39;</span><span class="p">:</span>
444            <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1000.0</span>
445        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;uniaxial&#39;</span><span class="p">:</span>
446            <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1000.0</span>
447            <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1000.0</span>
448        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;generalized&#39;</span><span class="p">:</span>
449            <span class="n">nTerm</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">])</span>
450            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nTerm</span><span class="p">):</span>
451                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Mustrain&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.01</span>
452        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotSizeStrainPO</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
453        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
454           
455    <span class="k">def</span> <span class="nf">OnHstrainRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
456        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
457        <span class="n">hist</span><span class="p">,</span><span class="n">pid</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
458        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;HStrain&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
459       
460    <span class="k">def</span> <span class="nf">OnHstrainVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
461        <span class="n">Snames</span> <span class="o">=</span> <span class="n">G2spc</span><span class="o">.</span><span class="n">HStrainNames</span><span class="p">(</span><span class="n">SGData</span><span class="p">)</span>
462        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
463        <span class="n">hist</span><span class="p">,</span><span class="n">pid</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
464        <span class="k">try</span><span class="p">:</span>
465            <span class="n">strain</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
466            <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;HStrain&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="n">pid</span><span class="p">]</span> <span class="o">=</span> <span class="n">strain</span>
467        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
468            <span class="k">pass</span>
469        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.5f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;HStrain&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="n">pid</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
470
471    <span class="k">def</span> <span class="nf">OnPOVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
472        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
473        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
474        <span class="k">try</span><span class="p">:</span>
475            <span class="n">mdVal</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
476            <span class="k">if</span> <span class="n">mdVal</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
477                <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">mdVal</span>
478        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
479            <span class="k">pass</span>
480        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.3f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
481       
482    <span class="k">def</span> <span class="nf">OnPOAxis</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
483        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
484        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
485        <span class="n">Saxis</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
486        <span class="k">try</span><span class="p">:</span>
487            <span class="n">hkl</span> <span class="o">=</span> <span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">Saxis</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">)]</span>
488        <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span><span class="ne">IndexError</span><span class="p">):</span>
489            <span class="n">hkl</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span>
490        <span class="k">if</span> <span class="ow">not</span> <span class="n">np</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">hkl</span><span class="p">)):</span>
491            <span class="n">hkl</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span>
492        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span> <span class="o">=</span> <span class="n">hkl</span>
493        <span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span> <span class="o">=</span> <span class="n">hkl</span>
494        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s"> </span><span class="si">%3d</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">h</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">l</span><span class="p">))</span> 
495       
496    <span class="k">def</span> <span class="nf">OnPOOrder</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
497        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
498        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
499        <span class="n">Order</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
500        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="n">Order</span>
501        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">5</span><span class="p">]</span> <span class="o">=</span> <span class="n">SetPOCoef</span><span class="p">(</span><span class="n">Order</span><span class="p">,</span><span class="n">hist</span><span class="p">)</span>
502        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
503
504    <span class="k">def</span> <span class="nf">OnPOType</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
505        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
506        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
507        <span class="k">if</span> <span class="s">&#39;March&#39;</span> <span class="ow">in</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
508            <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;MD&#39;</span>
509        <span class="k">else</span><span class="p">:</span>
510            <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;SH&#39;</span>
511        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>           
512
513    <span class="k">def</span> <span class="nf">OnPORef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
514        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
515        <span class="n">hist</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
516        <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
517           
518    <span class="k">def</span> <span class="nf">SetPOCoef</span><span class="p">(</span><span class="n">Order</span><span class="p">,</span><span class="n">hist</span><span class="p">):</span>
519        <span class="n">cofNames</span> <span class="o">=</span> <span class="n">G2lat</span><span class="o">.</span><span class="n">GenSHCoeff</span><span class="p">(</span><span class="n">SGData</span><span class="p">[</span><span class="s">&#39;SGLaue&#39;</span><span class="p">],</span><span class="s">&#39;0&#39;</span><span class="p">,</span><span class="n">Order</span><span class="p">,</span><span class="bp">False</span><span class="p">)</span>     <span class="c">#cylindrical &amp; no M</span>
520        <span class="n">newPOCoef</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">cofNames</span><span class="p">,</span><span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">cofNames</span><span class="p">))))</span>
521        <span class="n">POCoeff</span> <span class="o">=</span> <span class="n">UseList</span><span class="p">[</span><span class="n">hist</span><span class="p">][</span><span class="s">&#39;Pref.Ori.&#39;</span><span class="p">][</span><span class="mi">5</span><span class="p">]</span>
522        <span class="k">for</span> <span class="n">cofName</span> <span class="ow">in</span> <span class="n">POCoeff</span><span class="p">:</span>
523            <span class="k">if</span> <span class="n">cofName</span> <span class="ow">in</span>  <span class="n">cofNames</span><span class="p">:</span>
524                <span class="n">newPOCoef</span><span class="p">[</span><span class="n">cofName</span><span class="p">]</span> <span class="o">=</span> <span class="n">POCoeff</span><span class="p">[</span><span class="n">cofName</span><span class="p">]</span>
525        <span class="k">return</span> <span class="n">newPOCoef</span>
526   
527    <span class="k">def</span> <span class="nf">OnExtRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
528        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
529        <span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
530       
531    <span class="k">def</span> <span class="nf">OnExtVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
532        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
533        <span class="k">try</span><span class="p">:</span>
534            <span class="n">ext</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
535            <span class="k">if</span> <span class="n">ext</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
536                <span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">ext</span>
537        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
538            <span class="k">pass</span>
539        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.2f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>
540
541    <span class="k">def</span> <span class="nf">OnBabRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
542        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
543        <span class="n">item</span><span class="p">,</span><span class="n">bab</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
544        <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Babinet&#39;</span><span class="p">][</span><span class="s">&#39;Bab&#39;</span><span class="o">+</span><span class="n">bab</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
545       
546    <span class="k">def</span> <span class="nf">OnBabVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
547        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
548        <span class="n">item</span><span class="p">,</span><span class="n">bab</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
549        <span class="k">try</span><span class="p">:</span>
550            <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
551            <span class="k">if</span> <span class="n">val</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
552                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Babinet&#39;</span><span class="p">][</span><span class="s">&#39;Bab&#39;</span><span class="o">+</span><span class="n">bab</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
553        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
554            <span class="k">pass</span>
555        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.3f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="s">&#39;Babinet&#39;</span><span class="p">][</span><span class="s">&#39;Bab&#39;</span><span class="o">+</span><span class="n">bab</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>
556
557    <span class="k">def</span> <span class="nf">OnTbarVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
558        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
559        <span class="k">try</span><span class="p">:</span>
560            <span class="n">tbar</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
561            <span class="k">if</span> <span class="n">tbar</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
562                <span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="s">&#39;Tbar&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">tbar</span>
563        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
564            <span class="k">pass</span>
565        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.3f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="s">&#39;Tbar&#39;</span><span class="p">]))</span>
566
567    <span class="k">def</span> <span class="nf">OnCos2TM</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
568        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
569        <span class="k">try</span><span class="p">:</span>
570            <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
571            <span class="k">if</span> <span class="mf">0.</span> <span class="o">&lt;</span> <span class="n">val</span> <span class="o">&lt;=</span> <span class="mf">1.</span><span class="p">:</span>
572                <span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="s">&#39;Cos2TM&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
573        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
574            <span class="k">pass</span>
575        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.3f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="s">&#39;Cos2TM&#39;</span><span class="p">]))</span>
576       
577    <span class="k">def</span> <span class="nf">OnEval</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
578        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
579        <span class="n">item</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
580        <span class="k">try</span><span class="p">:</span>
581            <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
582            <span class="k">if</span> <span class="n">val</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
583                <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
584        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
585            <span class="k">pass</span>
586        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%10.3e</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]][</span><span class="mi">0</span><span class="p">]))</span>
587       
588    <span class="k">def</span> <span class="nf">OnEref</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
589        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
590        <span class="n">item</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
591        <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
592
593    <span class="k">def</span> <span class="nf">OnSCExtType</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
594        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
595        <span class="n">item</span> <span class="o">=</span> <span class="n">Indx</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
596        <span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="s">&#39;Extinction&#39;</span><span class="p">][</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
597        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateDData</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">DData</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
598           
599    <span class="k">def</span> <span class="nf">checkAxis</span><span class="p">(</span><span class="n">axis</span><span class="p">):</span>
600        <span class="k">if</span> <span class="ow">not</span> <span class="n">np</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">axis</span><span class="p">)):</span>
601            <span class="k">return</span> <span class="bp">False</span>
602        <span class="k">return</span> <span class="n">axis</span>
603       
604    <span class="k">def</span> <span class="nf">TopSizer</span><span class="p">(</span><span class="n">name</span><span class="p">,</span><span class="n">choices</span><span class="p">,</span><span class="n">parm</span><span class="p">,</span><span class="n">OnType</span><span class="p">):</span>
605        <span class="n">topSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
606        <span class="n">topSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="n">name</span><span class="p">),</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
607        <span class="n">sizeType</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ComboBox</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">parm</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="n">choices</span><span class="o">=</span><span class="n">choices</span><span class="p">,</span>
608            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">CB_READONLY</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">CB_DROPDOWN</span><span class="p">)</span>
609        <span class="n">sizeType</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">,</span> <span class="n">OnType</span><span class="p">)</span>
610        <span class="n">Indx</span><span class="p">[</span><span class="n">sizeType</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span> <span class="o">=</span> <span class="n">item</span>
611        <span class="n">topSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizeType</span><span class="p">)</span>
612        <span class="n">topSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">5</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span><span class="mi">0</span><span class="p">)</span>
613        <span class="k">return</span> <span class="n">topSizer</span>
614       
615    <span class="k">def</span> <span class="nf">LGmixSizer</span><span class="p">(</span><span class="n">name</span><span class="p">,</span><span class="n">OnVal</span><span class="p">,</span><span class="n">OnRef</span><span class="p">):</span>
616        <span class="n">lgmixSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
617        <span class="n">lgmixRef</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">CheckBox</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;LGmix&#39;</span><span class="p">)</span>
618        <span class="n">lgmixRef</span><span class="o">.</span><span class="n">thisown</span> <span class="o">=</span> <span class="bp">False</span>
619        <span class="n">lgmixRef</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">UseList</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">name</span><span class="p">][</span><span class="mi">2</span><span class="p">][</span><span class="mi">2</span><span class="p">])</span>
620        <span class="n">Indx</span><span class="p">[</span><span class="n">lgmixRef</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span> <span class="o">=</span> <span class="p">[</span><span class="n">item</span><span class="p">,</span><span class="n">name</span><span class="p">]</span>
621        <span class="n">lgmixRef</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_CHECKBOX</span><span class="p">,</span> <span class="n">OnRef</span><span class="p">)</span>
622        <span class="n">lgmixSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">lgmixRef</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
623        <span class="n">lgmixVal</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">(</span><span class="n">DData</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span>
624            <span class