Ignore:
Timestamp:
Dec 16, 2013 10:43:01 AM (9 years ago)
Author:
toby
Message:

update imports to provide error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sphinxdocs/build/html/_modules/GSASIIimgGUI.html

    r1129 r1168  
    5454<span class="c">#GSASII - image data display routines</span>
    5555<span class="c">########### SVN repository information ###################</span>
    56 <span class="c"># $Date: 2013-09-17 16:22:51 -0500 (Tue, 17 Sep 2013) $</span>
    57 <span class="c"># $Author: toby $</span>
    58 <span class="c"># $Revision: 1057 $</span>
    59 <span class="c"># $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/GSASIIimgGUI.py $</span>
    60 <span class="c"># $Id: GSASIIimgGUI.py 1057 2013-09-17 21:22:51Z toby $</span>
     56<span class="c"># $Date: 2013-11-27 14:34:56 -0600 (Wed, 27 Nov 2013) $</span>
     57<span class="c"># $Author: vondreele $</span>
     58<span class="c"># $Revision: 1158 $</span>
     59<span class="c"># $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/GSASIIimgGUI.py $</span>
     60<span class="c"># $Id: GSASIIimgGUI.py 1158 2013-11-27 20:34:56Z vondreele $</span>
    6161<span class="c">########### SVN repository information ###################</span>
    6262<span class="sd">&#39;&#39;&#39;</span>
     
    7474<span class="kn">import</span> <span class="nn">cPickle</span>
    7575<span class="kn">import</span> <span class="nn">GSASIIpath</span>
    76 <span class="n">GSASIIpath</span><span class="o">.</span><span class="n">SetVersionNumber</span><span class="p">(</span><span class="s">&quot;$Revision: 1057 $&quot;</span><span class="p">)</span>
     76<span class="n">GSASIIpath</span><span class="o">.</span><span class="n">SetVersionNumber</span><span class="p">(</span><span class="s">&quot;$Revision: 1158 $&quot;</span><span class="p">)</span>
    7777<span class="kn">import</span> <span class="nn">GSASIIimage</span> <span class="kn">as</span> <span class="nn">G2img</span>
    7878<span class="kn">import</span> <span class="nn">GSASIIplot</span> <span class="kn">as</span> <span class="nn">G2plt</span>
     
    114114       
    115115    <span class="k">def</span> <span class="nf">OnRecalibrate</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    116         <span class="n">G2img</span><span class="o">.</span><span class="n">ImageRecalibrate</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
     116        <span class="n">G2img</span><span class="o">.</span><span class="n">ImageRecalibrate</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">masks</span><span class="p">)</span>
    117117        <span class="n">UpdateImageControls</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">masks</span><span class="p">)</span>
    118118       
     
    125125           
    126126    <span class="k">def</span> <span class="nf">OnIntegrate</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    127         <span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]:</span>
    128             <span class="n">maskCopy</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">masks</span><span class="p">)</span>
    129             <span class="n">backImg</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
    130             <span class="n">backScale</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
    131             <span class="nb">id</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">backImg</span><span class="p">)</span>
    132             <span class="n">Npix</span><span class="p">,</span><span class="n">imagefile</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
    133             <span class="n">backImage</span> <span class="o">=</span> <span class="n">G2IO</span><span class="o">.</span><span class="n">GetImageData</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">imagefile</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span><span class="o">*</span><span class="n">backScale</span>
    134             <span class="n">sumImage</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">ImageZ</span><span class="o">+</span><span class="n">backImage</span>
    135             <span class="n">sumMin</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">sumImage</span><span class="p">)</span>
    136             <span class="n">sumMax</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">sumImage</span><span class="p">)</span>
    137             <span class="n">maskCopy</span><span class="p">[</span><span class="s">&#39;Thresholds&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[(</span><span class="n">sumMin</span><span class="p">,</span><span class="n">sumMax</span><span class="p">),[</span><span class="n">sumMin</span><span class="p">,</span><span class="n">sumMax</span><span class="p">]]</span>
    138             <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">sumImage</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">maskCopy</span><span class="p">)</span>
    139         <span class="k">else</span><span class="p">:</span>
    140             <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">ImageZ</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">masks</span><span class="p">)</span>
    141         <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotIntegration</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">newPlot</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
    142         <span class="n">G2IO</span><span class="o">.</span><span class="n">SaveIntegration</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">G2frame</span><span class="o">.</span><span class="n">PickId</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
     127        <span class="n">blkSize</span> <span class="o">=</span> <span class="mi">128</span>   <span class="c">#this seems to be optimal; will break in polymask if &gt;1024</span>
     128        <span class="n">Nx</span><span class="p">,</span><span class="n">Ny</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span>
     129        <span class="n">nXBlks</span> <span class="o">=</span> <span class="p">(</span><span class="n">Nx</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="n">blkSize</span><span class="o">+</span><span class="mi">1</span>
     130        <span class="n">nYBlks</span> <span class="o">=</span> <span class="p">(</span><span class="n">Ny</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="n">blkSize</span><span class="o">+</span><span class="mi">1</span>
     131        <span class="n">Nup</span> <span class="o">=</span> <span class="n">nXBlks</span><span class="o">*</span><span class="n">nYBlks</span><span class="o">*</span><span class="mi">3</span><span class="o">+</span><span class="mi">3</span>
     132        <span class="n">dlg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ProgressDialog</span><span class="p">(</span><span class="s">&quot;Elapsed time&quot;</span><span class="p">,</span><span class="s">&quot;2D image integration&quot;</span><span class="p">,</span><span class="n">Nup</span><span class="p">,</span>
     133            <span class="n">style</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">PD_ELAPSED_TIME</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">PD_AUTO_HIDE</span><span class="p">)</span>
     134        <span class="k">try</span><span class="p">:</span>
     135            <span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]:</span>
     136                <span class="n">maskCopy</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">masks</span><span class="p">)</span>
     137                <span class="n">backImg</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
     138                <span class="n">backScale</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
     139                <span class="nb">id</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">backImg</span><span class="p">)</span>
     140                <span class="n">Npix</span><span class="p">,</span><span class="n">imagefile</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
     141                <span class="n">backImage</span> <span class="o">=</span> <span class="n">G2IO</span><span class="o">.</span><span class="n">GetImageData</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">imagefile</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span><span class="o">*</span><span class="n">backScale</span>
     142                <span class="n">sumImage</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">ImageZ</span><span class="o">+</span><span class="n">backImage</span>
     143                <span class="n">sumMin</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">sumImage</span><span class="p">)</span>
     144                <span class="n">sumMax</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">sumImage</span><span class="p">)</span>
     145                <span class="n">maskCopy</span><span class="p">[</span><span class="s">&#39;Thresholds&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[(</span><span class="n">sumMin</span><span class="p">,</span><span class="n">sumMax</span><span class="p">),[</span><span class="n">sumMin</span><span class="p">,</span><span class="n">sumMax</span><span class="p">]]</span>
     146                <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">sumImage</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">maskCopy</span><span class="p">,</span><span class="n">blkSize</span><span class="p">,</span><span class="n">dlg</span><span class="p">)</span>
     147            <span class="k">else</span><span class="p">:</span>
     148                <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">ImageZ</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">masks</span><span class="p">,</span><span class="n">blkSize</span><span class="p">,</span><span class="n">dlg</span><span class="p">)</span>
     149    <span class="c">#        G2plt.PlotIntegration(G2frame,newPlot=True)</span>
     150            <span class="n">G2IO</span><span class="o">.</span><span class="n">SaveIntegration</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">G2frame</span><span class="o">.</span><span class="n">PickId</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
     151        <span class="k">finally</span><span class="p">:</span>
     152            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
    143153        <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">MakePDF</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>
    144154       
     
    168178                        <span class="n">ifintegrate</span><span class="p">,</span><span class="n">name</span><span class="p">,</span><span class="nb">id</span> <span class="o">=</span> <span class="n">item</span>
    169179                        <span class="k">if</span> <span class="n">ifintegrate</span><span class="p">:</span>
    170                             <span class="nb">id</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
    171                             <span class="n">Npix</span><span class="p">,</span><span class="n">imagefile</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
    172                             <span class="n">image</span> <span class="o">=</span> <span class="n">G2IO</span><span class="o">.</span><span class="n">GetImageData</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">imagefile</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span>
    173180                            <span class="n">Id</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="nb">id</span><span class="p">,</span> <span class="s">&#39;Image Controls&#39;</span><span class="p">)</span>
    174181                            <span class="n">Data</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span><span class="n">Id</span><span class="p">)</span>
    175                             <span class="n">backImage</span> <span class="o">=</span> <span class="p">[]</span>
    176                             <span class="k">if</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]:</span>
    177                                 <span class="n">backImg</span> <span class="o">=</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
    178                                 <span class="n">backScale</span> <span class="o">=</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
    179                                 <span class="nb">id</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">backImg</span><span class="p">)</span>
     182                            <span class="n">blkSize</span> <span class="o">=</span> <span class="mi">128</span>   <span class="c">#this seems to be optimal; will break in polymask if &gt;1024</span>
     183                            <span class="n">Nx</span><span class="p">,</span><span class="n">Ny</span> <span class="o">=</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span>
     184                            <span class="n">nXBlks</span> <span class="o">=</span> <span class="p">(</span><span class="n">Nx</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="n">blkSize</span><span class="o">+</span><span class="mi">1</span>
     185                            <span class="n">nYBlks</span> <span class="o">=</span> <span class="p">(</span><span class="n">Ny</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="n">blkSize</span><span class="o">+</span><span class="mi">1</span>
     186                            <span class="n">Nup</span> <span class="o">=</span> <span class="n">nXBlks</span><span class="o">*</span><span class="n">nYBlks</span><span class="o">*</span><span class="mi">3</span><span class="o">+</span><span class="mi">3</span>
     187                            <span class="n">dlgp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ProgressDialog</span><span class="p">(</span><span class="s">&quot;Elapsed time&quot;</span><span class="p">,</span><span class="s">&quot;2D image integration&quot;</span><span class="p">,</span><span class="n">Nup</span><span class="p">,</span>
     188                                <span class="n">style</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">PD_ELAPSED_TIME</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">PD_AUTO_HIDE</span><span class="p">)</span>
     189                            <span class="k">try</span><span class="p">:</span>
     190                                <span class="nb">id</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
    180191                                <span class="n">Npix</span><span class="p">,</span><span class="n">imagefile</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
    181                                 <span class="n">backImage</span> <span class="o">=</span> <span class="n">G2IO</span><span class="o">.</span><span class="n">GetImageData</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">imagefile</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span><span class="o">*</span><span class="n">backScale</span>
    182                             <span class="k">try</span><span class="p">:</span>
    183                                 <span class="n">Masks</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span>
    184                                     <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">G2frame</span><span class="o">.</span><span class="n">Image</span><span class="p">,</span> <span class="s">&#39;Masks&#39;</span><span class="p">))</span>
    185                             <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>       <span class="c">#missing Masks</span>
    186                                 <span class="n">Imin</span><span class="p">,</span><span class="n">Imax</span> <span class="o">=</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;Range&#39;</span><span class="p">]</span>
    187                                 <span class="n">Masks</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;Points&#39;</span><span class="p">:[],</span><span class="s">&#39;Rings&#39;</span><span class="p">:[],</span><span class="s">&#39;Arcs&#39;</span><span class="p">:[],</span><span class="s">&#39;Polygons&#39;</span><span class="p">:[],</span><span class="s">&#39;Thresholds&#39;</span><span class="p">:[(</span><span class="n">Imin</span><span class="p">,</span><span class="n">Imax</span><span class="p">),[</span><span class="n">Imin</span><span class="p">,</span><span class="n">Imax</span><span class="p">]]}</span>
    188                                 <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">SetItemPyData</span><span class="p">(</span>
    189                                     <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">G2frame</span><span class="o">.</span><span class="n">Image</span><span class="p">,</span> <span class="s">&#39;Masks&#39;</span><span class="p">),</span><span class="n">Masks</span><span class="p">)</span>
    190                             <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">backImage</span><span class="p">):</span>                               
    191                                 <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">image</span><span class="o">+</span><span class="n">backImage</span><span class="p">,</span><span class="n">Data</span><span class="p">,</span><span class="n">Masks</span><span class="p">)</span>
    192                             <span class="k">else</span><span class="p">:</span>
    193                                 <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">image</span><span class="p">,</span><span class="n">Data</span><span class="p">,</span><span class="n">Masks</span><span class="p">)</span>
    194 <span class="c">#                            G2plt.PlotIntegration(G2frame,newPlot=True,event=event)</span>
    195                             <span class="n">G2IO</span><span class="o">.</span><span class="n">SaveIntegration</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">Id</span><span class="p">,</span><span class="n">Data</span><span class="p">)</span>
     192                                <span class="n">image</span> <span class="o">=</span> <span class="n">G2IO</span><span class="o">.</span><span class="n">GetImageData</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">imagefile</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span>
     193                                <span class="n">backImage</span> <span class="o">=</span> <span class="p">[]</span>
     194                                <span class="k">if</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]:</span>
     195                                    <span class="n">backImg</span> <span class="o">=</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
     196                                    <span class="n">backScale</span> <span class="o">=</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;background image&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
     197                                    <span class="nb">id</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">backImg</span><span class="p">)</span>
     198                                    <span class="n">Npix</span><span class="p">,</span><span class="n">imagefile</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
     199                                    <span class="n">backImage</span> <span class="o">=</span> <span class="n">G2IO</span><span class="o">.</span><span class="n">GetImageData</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">imagefile</span><span class="p">,</span><span class="bp">True</span><span class="p">)</span><span class="o">*</span><span class="n">backScale</span>
     200                                <span class="k">try</span><span class="p">:</span>
     201                                    <span class="n">Masks</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span>
     202                                        <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">G2frame</span><span class="o">.</span><span class="n">Image</span><span class="p">,</span> <span class="s">&#39;Masks&#39;</span><span class="p">))</span>
     203                                <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>       <span class="c">#missing Masks</span>
     204                                    <span class="n">Imin</span><span class="p">,</span><span class="n">Imax</span> <span class="o">=</span> <span class="n">Data</span><span class="p">[</span><span class="s">&#39;Range&#39;</span><span class="p">]</span>
     205                                    <span class="n">Masks</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;Points&#39;</span><span class="p">:[],</span><span class="s">&#39;Rings&#39;</span><span class="p">:[],</span><span class="s">&#39;Arcs&#39;</span><span class="p">:[],</span><span class="s">&#39;Polygons&#39;</span><span class="p">:[],</span><span class="s">&#39;Frames&#39;</span><span class="p">:[],</span><span class="s">&#39;Thresholds&#39;</span><span class="p">:[(</span><span class="n">Imin</span><span class="p">,</span><span class="n">Imax</span><span class="p">),[</span><span class="n">Imin</span><span class="p">,</span><span class="n">Imax</span><span class="p">]]}</span>
     206                                    <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">SetItemPyData</span><span class="p">(</span>
     207                                        <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">G2frame</span><span class="o">.</span><span class="n">Image</span><span class="p">,</span> <span class="s">&#39;Masks&#39;</span><span class="p">),</span><span class="n">Masks</span><span class="p">)</span>
     208                                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">backImage</span><span class="p">):</span>                               
     209                                    <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">image</span><span class="o">+</span><span class="n">backImage</span><span class="p">,</span><span class="n">Data</span><span class="p">,</span><span class="n">Masks</span><span class="p">,</span><span class="n">blkSize</span><span class="p">,</span><span class="n">dlgp</span><span class="p">)</span>
     210                                <span class="k">else</span><span class="p">:</span>
     211                                    <span class="n">G2frame</span><span class="o">.</span><span class="n">Integrate</span> <span class="o">=</span> <span class="n">G2img</span><span class="o">.</span><span class="n">ImageIntegrate</span><span class="p">(</span><span class="n">image</span><span class="p">,</span><span class="n">Data</span><span class="p">,</span><span class="n">Masks</span><span class="p">,</span><span class="n">blkSize</span><span class="p">,</span><span class="n">dlgp</span><span class="p">)</span>
     212<span class="c">#                               G2plt.PlotIntegration(G2frame,newPlot=True,event=event)</span>
     213                                <span class="n">G2IO</span><span class="o">.</span><span class="n">SaveIntegration</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">Id</span><span class="p">,</span><span class="n">Data</span><span class="p">)</span>
     214                            <span class="k">finally</span><span class="p">:</span>
     215                                <span class="n">dlgp</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
    196216            <span class="k">finally</span><span class="p">:</span>
    197217                <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
     
    252272                <span class="n">keys</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;type&#39;</span><span class="p">,</span><span class="s">&#39;wavelength&#39;</span><span class="p">,</span><span class="s">&#39;calibrant&#39;</span><span class="p">,</span><span class="s">&#39;distance&#39;</span><span class="p">,</span><span class="s">&#39;center&#39;</span><span class="p">,</span>
    253273                    <span class="s">&#39;tilt&#39;</span><span class="p">,</span><span class="s">&#39;rotation&#39;</span><span class="p">,</span><span class="s">&#39;azmthOff&#39;</span><span class="p">,</span><span class="s">&#39;fullIntegrate&#39;</span><span class="p">,</span><span class="s">&#39;LRazimuth&#39;</span><span class="p">,</span>
    254                     <span class="s">&#39;IOtth&#39;</span><span class="p">,</span><span class="s">&#39;outAzimuths&#39;</span><span class="p">]</span>
     274                    <span class="s">&#39;IOtth&#39;</span><span class="p">,</span><span class="s">&#39;outAzimuths&#39;</span><span class="p">,</span><span class="s">&#39;invert_x&#39;</span><span class="p">,</span><span class="s">&#39;invert_y&#39;</span><span class="p">]</span>
    255275                <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
    256276                    <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;rotation&#39;</span><span class="p">]:</span>
    257                         <span class="n">File</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">key</span><span class="o">+</span><span class="s">&#39;:&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">-</span><span class="mf">90.</span><span class="p">)</span><span class="o">+</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>                       
     277                        <span class="n">File</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">key</span><span class="o">+</span><span class="s">&#39;:&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">key</span><span class="p">])</span><span class="o">+</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>                       
    258278                    <span class="k">else</span><span class="p">:</span>
    259279                        <span class="n">File</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">key</span><span class="o">+</span><span class="s">&#39;:&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">key</span><span class="p">])</span><span class="o">+</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
     
    263283       
    264284    <span class="k">def</span> <span class="nf">OnLoadControls</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    265         <span class="n">cntlList</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;wavelength&#39;</span><span class="p">,</span><span class="s">&#39;distance&#39;</span><span class="p">,</span><span class="s">&#39;tilt&#39;</span><span class="p">,</span><span class="s">&#39;rotation&#39;</span><span class="p">,</span>
    266             <span class="s">&#39;fullIntegrate&#39;</span><span class="p">,</span><span class="s">&#39;outAzimuths&#39;</span><span class="p">,</span><span class="s">&#39;LRazimuth&#39;</span><span class="p">,</span><span class="s">&#39;IOtth&#39;</span><span class="p">]</span>
     285        <span class="n">cntlList</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;wavelength&#39;</span><span class="p">,</span><span class="s">&#39;distance&#39;</span><span class="p">,</span><span class="s">&#39;tilt&#39;</span><span class="p">,</span><span class="s">&#39;invert_x&#39;</span><span class="p">,</span><span class="s">&#39;invert_y&#39;</span><span class="p">,</span>
     286            <span class="s">&#39;fullIntegrate&#39;</span><span class="p">,</span><span class="s">&#39;outAzimuths&#39;</span><span class="p">,</span><span class="s">&#39;LRazimuth&#39;</span><span class="p">,</span><span class="s">&#39;IOtth&#39;</span><span class="p">,</span><span class="s">&#39;azmthOff&#39;</span><span class="p">]</span>
    267287        <span class="n">dlg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FileDialog</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span> <span class="s">&#39;Choose image controls file&#39;</span><span class="p">,</span> <span class="s">&#39;.&#39;</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
    268288            <span class="s">&#39;image control files (*.imctrl)|*.imctrl&#39;</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">OPEN</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">CHANGE_DIR</span><span class="p">)</span>
     
    281301                        <span class="n">save</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
    282302                    <span class="k">elif</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;rotation&#39;</span><span class="p">]:</span>
    283                         <span class="n">save</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">val</span><span class="p">)</span><span class="o">+</span><span class="mf">90.</span>
     303                        <span class="n">save</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
    284304                    <span class="k">elif</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;center&#39;</span><span class="p">,]:</span>
    285305                        <span class="k">if</span> <span class="s">&#39;,&#39;</span> <span class="ow">in</span> <span class="n">val</span><span class="p">:</span>
     
    305325        <span class="k">def</span> <span class="nf">OnDataType</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    306326            <span class="n">data</span><span class="p">[</span><span class="s">&#39;type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">typeSel</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()[:</span><span class="mi">4</span><span class="p">]</span>
     327            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateImageControls</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">masks</span><span class="p">)</span>
    307328   
    308329        <span class="k">def</span> <span class="nf">OnNewColorBar</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     
    317338                <span class="k">pass</span>
    318339            <span class="n">azmthOff</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">data</span><span class="p">[</span><span class="s">&#39;azmthOff&#39;</span><span class="p">]))</span>          <span class="c">#reset in case of error  </span>
     340            <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotExposedImage</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
    319341       
    320342        <span class="n">comboSizer</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>
     
    466488        <span class="n">calibSizer</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; Tilt rotation&#39;</span><span class="p">),</span><span class="mi">0</span><span class="p">,</span>
    467489            <span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    468         <span class="n">rotSel</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%9.3f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;rotation&#39;</span><span class="p">]</span><span class="o">-</span><span class="mf">90.</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_READONLY</span><span class="p">)</span> <span class="c">#kluge to get rotation from vertical - see GSASIIimage</span>
     490        <span class="n">rotSel</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%9.3f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;rotation&#39;</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_READONLY</span><span class="p">)</span>
    469491        <span class="n">rotSel</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
    470492        <span class="n">calibSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">rotSel</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>
     
    575597            <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotExposedImage</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
    576598               
    577         <span class="n">dataSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FlexGridSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
     599        <span class="k">def</span> <span class="nf">OnApplyPola</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     600            <span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]:</span>
     601                <span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
     602            <span class="k">else</span><span class="p">:</span>
     603                <span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
     604               
     605        <span class="k">def</span> <span class="nf">OnPolaVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     606            <span class="k">try</span><span class="p">:</span>
     607                <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">polaVal</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
     608                <span class="k">if</span> <span class="mf">0.001</span> <span class="o">&lt;=</span> <span class="n">value</span> <span class="o">&lt;=</span> <span class="mf">0.999</span><span class="p">:</span>
     609                    <span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
     610                <span class="k">else</span><span class="p">:</span>
     611                    <span class="k">raise</span> <span class="ne">ValueError</span>
     612            <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
     613                <span class="k">pass</span>
     614            <span class="n">polaVal</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%.3f</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>
     615                           
     616        <span class="n">dataSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FlexGridSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
    578617        <span class="n">dataSizer</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; Integration coefficients&#39;</span><span class="p">),</span><span class="mi">0</span><span class="p">,</span>
    579618            <span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>   
     
    638677        <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">obliqVal</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>
    639678        <span class="n">dataSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">littleSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,)</span>
     679        <span class="k">if</span> <span class="s">&#39;SASD&#39;</span> <span class="ow">in</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;type&#39;</span><span class="p">]:</span>
     680            <span class="n">littleSizer</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>
     681            <span class="n">setPolariz</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;Apply polarization?&#39;</span><span class="p">)</span>
     682            <span class="n">dataSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">setPolariz</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>
     683            <span class="n">setPolariz</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">OnApplyPola</span><span class="p">)</span>
     684            <span class="n">setPolariz</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
     685            <span class="n">littleSizer</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">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;Value (0.001-0.999)  &#39;</span><span class="p">),</span><span class="mi">0</span><span class="p">,</span>
     686                <span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
     687            <span class="n">polaVal</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%.3f</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]),</span>
     688                <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>
     689            <span class="n">polaVal</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">OnPolaVal</span><span class="p">)</span>
     690            <span class="n">polaVal</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">OnPolaVal</span><span class="p">)</span>
     691            <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">polaVal</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>
     692            <span class="n">dataSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">littleSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,)</span>
    640693       
    641694        <span class="n">showLines</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;Show integration limits?&#39;</span><span class="p">)</span>
     
    824877    <span class="k">if</span> <span class="s">&#39;Oblique&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
    825878        <span class="n">data</span><span class="p">[</span><span class="s">&#39;Oblique&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.5</span><span class="p">,</span><span class="bp">False</span><span class="p">]</span>
     879    <span class="k">if</span> <span class="s">&#39;PolaVal&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
     880        <span class="n">data</span><span class="p">[</span><span class="s">&#39;PolaVal&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.99</span><span class="p">,</span><span class="bp">False</span><span class="p">]</span>
    826881    <span class="c">#end fix</span>
    827882   
     
    9571012        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotExposedImage</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
    9581013
     1014    <span class="k">def</span> <span class="nf">OnDeleteFrame</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1015        <span class="n">data</span><span class="p">[</span><span class="s">&#39;Frames&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
     1016        <span class="n">UpdateMasks</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
     1017        <span class="n">G2plt</span><span class="o">.</span><span class="n">PlotExposedImage</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
     1018
    9591019    <span class="k">def</span> <span class="nf">OnCopyMask</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    9601020        <span class="kn">import</span> <span class="nn">copy</span>
     
    10021062                <span class="n">File</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span><span class="s">&#39;w&#39;</span><span class="p">)</span>
    10031063                <span class="n">save</span> <span class="o">=</span> <span class="p">{}</span>
    1004                 <span class="n">keys</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Points&#39;</span><span class="p">,</span><span class="s">&#39;Rings&#39;</span><span class="p">,</span><span class="s">&#39;Arcs&#39;</span><span class="p">,</span><span class="s">&#39;Polygons&#39;</span><span class="p">,</span><span class="s">&#39;Thresholds&#39;</span><span class="p">]</span>
     1064                <span class="n">keys</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Points&#39;</span><span class="p">,</span><span class="s">&#39;Rings&#39;</span><span class="p">,</span><span class="s">&#39;Arcs&#39;</span><span class="p">,</span><span class="s">&#39;Polygons&#39;</span><span class="p">,</span><span class="s">&#39;Frames&#39;</span><span class="p">,</span><span class="s">&#39;Thresholds&#39;</span><span class="p">]</span>
    10051065                <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
    10061066                    <span class="n">File</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">key</span><span class="o">+</span><span class="s">&#39;:&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">key</span><span class="p">])</span><span class="o">+</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
     
    10241084                        <span class="k">continue</span>
    10251085                    <span class="p">[</span><span class="n">key</span><span class="p">,</span><span class="n">val</span><span class="p">]</span> <span class="o">=</span> <span class="n">S</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;:&#39;</span><span class="p">)</span>
    1026                     <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;Points&#39;</span><span class="p">,</span><span class="s">&#39;Rings&#39;</span><span class="p">,</span><span class="s">&#39;Arcs&#39;</span><span class="p">,</span><span class="s">&#39;Polygons&#39;</span><span class="p">,</span><span class="s">&#39;Thresholds&#39;</span><span class="p">]:</span>
     1086                    <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;Points&#39;</span><span class="p">,</span><span class="s">&#39;Rings&#39;</span><span class="p">,</span><span class="s">&#39;Arcs&#39;</span><span class="p">,</span><span class="s">&#39;Polygons&#39;</span><span class="p">,</span><span class="s">&#39;Frames&#39;</span><span class="p">,</span><span class="s">&#39;Thresholds&#39;</span><span class="p">]:</span>
    10271087                        <span class="n">save</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="nb">eval</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
    10281088                        <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="s">&#39;Thresholds&#39;</span><span class="p">:</span>
     
    10371097        <span class="k">finally</span><span class="p">:</span>
    10381098            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
    1039        
     1099           
     1100    <span class="k">def</span> <span class="nf">OnNewSpotMask</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1101        <span class="s">&#39;Start a new spot mask&#39;</span>
     1102        <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">=</span> <span class="s">&#39;s&#39;</span>
     1103        <span class="n">G2plt</span><span class="o">.</span><span class="n">OnStartMask</span><span class="p">(</span><span class="n">G2frame</span><span class="p">)</span>
     1104       
     1105    <span class="k">def</span> <span class="nf">OnNewArcMask</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1106        <span class="s">&#39;Start a new arc mask&#39;</span>
     1107        <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">=</span> <span class="s">&#39;a&#39;</span>
     1108        <span class="n">G2plt</span><span class="o">.</span><span class="n">OnStartMask</span><span class="p">(</span><span class="n">G2frame</span><span class="p">)</span>
     1109       
     1110    <span class="k">def</span> <span class="nf">OnNewRingMask</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1111        <span class="s">&#39;Start a new ring mask&#39;</span>
     1112        <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">=</span> <span class="s">&#39;r&#39;</span>
     1113        <span class="n">G2plt</span><span class="o">.</span><span class="n">OnStartMask</span><span class="p">(</span><span class="n">G2frame</span><span class="p">)</span>
     1114       
     1115    <span class="k">def</span> <span class="nf">OnNewPolyMask</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1116        <span class="s">&#39;Start a new polygon mask&#39;</span>
     1117        <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">=</span> <span class="s">&#39;p&#39;</span>
     1118        <span class="n">G2plt</span><span class="o">.</span><span class="n">OnStartMask</span><span class="p">(</span><span class="n">G2frame</span><span class="p">)</span>
     1119       
     1120    <span class="k">def</span> <span class="nf">OnNewFrameMask</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1121        <span class="s">&#39;Start a new Frame mask&#39;</span>
     1122        <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">=</span> <span class="s">&#39;f&#39;</span>
     1123        <span class="n">G2plt</span><span class="o">.</span><span class="n">OnStartMask</span><span class="p">(</span><span class="n">G2frame</span><span class="p">)</span>
     1124               
    10401125    <span class="k">if</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">:</span>
    10411126        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
     
    10431128    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnCopyMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_MASKCOPY</span><span class="p">)</span>
    10441129    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnLoadMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_MASKLOAD</span><span class="p">)</span>
    1045     <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnSaveMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_MASKSAVE</span><span class="p">)</span>   
     1130    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnSaveMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_MASKSAVE</span><span class="p">)</span>
     1131    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnNewSpotMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_NEWMASKSPOT</span><span class="p">)</span>
     1132    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnNewArcMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_NEWMASKARC</span><span class="p">)</span>
     1133    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnNewRingMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_NEWMASKRING</span><span class="p">)</span>
     1134    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnNewPolyMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_NEWMASKPOLY</span><span class="p">)</span>
     1135    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</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_MENU</span><span class="p">,</span> <span class="n">OnNewFrameMask</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">G2gd</span><span class="o">.</span><span class="n">wxID_NEWMASKFRAME</span><span class="p">)</span>
    10461136    <span class="k">if</span> <span class="ow">not</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">GetStatusBar</span><span class="p">():</span>
    10471137        <span class="n">Status</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">CreateStatusBar</span><span class="p">()</span>
    1048         <span class="n">Status</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&quot;To add mask: On 2D Powder Image, key a:arc, r:ring, s:spot, p:polygon&quot;</span><span class="p">)</span>
     1138    <span class="k">if</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">==</span> <span class="s">&#39;f&#39;</span><span class="p">:</span>
     1139        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">GetStatusBar</span><span class="p">()</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;Frame mask active - LB pick next point, RB close polygon&#39;</span><span class="p">)</span>
     1140    <span class="k">elif</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">==</span> <span class="s">&#39;p&#39;</span><span class="p">:</span>
     1141        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">GetStatusBar</span><span class="p">()</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;Polygon mask active - LB pick next point, RB close polygon&#39;</span><span class="p">)</span>
     1142    <span class="k">elif</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">==</span> <span class="s">&#39;s&#39;</span><span class="p">:</span>
     1143        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">GetStatusBar</span><span class="p">()</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;Spot mask active - LB pick spot location&#39;</span><span class="p">)</span>
     1144    <span class="k">elif</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">==</span> <span class="s">&#39;a&#39;</span><span class="p">:</span>
     1145        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">GetStatusBar</span><span class="p">()</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;Arc mask active - LB pick arc location&#39;</span><span class="p">)</span>
     1146    <span class="k">elif</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">MaskKey</span> <span class="o">==</span> <span class="s">&#39;r&#39;</span><span class="p">:</span>
     1147        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">GetStatusBar</span><span class="p">()</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;Ring mask active - LB pick ring location&#39;</span><span class="p">)</span>
     1148    <span class="k">else</span><span class="p">:</span>
     1149        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">GetStatusBar</span><span class="p">()</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&quot;To add mask: On 2D Powder Image, key a:arc, r:ring, s:spot, p:polygon, f:frame&quot;</span><span class="p">)</span>
    10491150    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="p">)</span>
    10501151    <span class="n">mainSizer</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>
     
    10551156    <span class="n">rings</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Rings&#39;</span><span class="p">]</span>               <span class="c">#radius, thickness</span>
    10561157    <span class="n">polygons</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Polygons&#39;</span><span class="p">]</span>         <span class="c">#3+ x,y pairs</span>
     1158    <span class="k">if</span> <span class="s">&#39;Frames&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
     1159        <span class="n">data</span><span class="p">[</span><span class="s">&#39;Frames&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
     1160    <span class="n">frame</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Frames&#39;</span><span class="p">]</span>             <span class="c">#3+ x,y pairs</span>
    10571161    <span class="n">arcs</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Arcs&#39;</span><span class="p">]</span>                 <span class="c">#radius, start/end azimuth, thickness</span>
    10581162   
     
    10921196            <span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    10931197        <span class="n">littleSizer</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>
    1094         <span class="k">for</span> <span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">d</span> <span class="ow">in</span> <span class="n">spots</span><span class="p">:</span>
    1095             <span class="n">spotText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.2f</span><span class="s">,</span><span class="si">%.2f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">)),</span>
    1096                 <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
    1097             <span class="n">spotText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
    1098             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">spotText</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>
    1099             <span class="n">spotText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
    1100             <span class="n">spotDiameter</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">d</span><span class="p">)),</span>
    1101                 <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>
    1102             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">spotDiameter</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>
    1103             <span class="n">spotDiameter</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">OnSpotDiameter</span><span class="p">)</span>
    1104             <span class="n">spotDiameter</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">OnSpotDiameter</span><span class="p">)</span>
    1105             <span class="n">spotIds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">spotDiameter</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
    1106             <span class="n">spotDelete</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;delete?&#39;</span><span class="p">)</span>
    1107             <span class="n">spotDelete</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">OnDeleteSpot</span><span class="p">)</span>
    1108             <span class="n">delSpotId</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">spotDelete</span><span class="p">)</span>
    1109             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">spotDelete</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>
     1198        <span class="k">for</span> <span class="n">spot</span> <span class="ow">in</span> <span class="n">spots</span><span class="p">:</span>
     1199            <span class="k">if</span> <span class="n">spot</span><span class="p">:</span>
     1200                <span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">d</span> <span class="o">=</span> <span class="n">spot</span>
     1201                <span class="n">spotText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.2f</span><span class="s">,</span><span class="si">%.2f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">)),</span>
     1202                    <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
     1203                <span class="n">spotText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
     1204                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">spotText</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>
     1205                <span class="n">spotText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
     1206                <span class="n">spotDiameter</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">d</span><span class="p">)),</span>
     1207                    <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>
     1208                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">spotDiameter</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>
     1209                <span class="n">spotDiameter</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">OnSpotDiameter</span><span class="p">)</span>
     1210                <span class="n">spotDiameter</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">OnSpotDiameter</span><span class="p">)</span>
     1211                <span class="n">spotIds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">spotDiameter</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
     1212                <span class="n">spotDelete</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;delete?&#39;</span><span class="p">)</span>
     1213                <span class="n">spotDelete</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">OnDeleteSpot</span><span class="p">)</span>
     1214                <span class="n">delSpotId</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">spotDelete</span><span class="p">)</span>
     1215                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">spotDelete</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>
    11101216        <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">littleSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,)</span>
    11111217    <span class="n">ringIds</span> <span class="o">=</span> <span class="p">[]</span>
     
    11221228            <span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    11231229        <span class="n">littleSizer</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>
    1124         <span class="k">for</span> <span class="n">tth</span><span class="p">,</span><span class="n">thick</span> <span class="ow">in</span> <span class="n">rings</span><span class="p">:</span>
    1125             <span class="n">ringText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">tth</span><span class="p">)),</span>
    1126                 <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
    1127             <span class="n">ringText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
    1128             <span class="n">ringText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
    1129             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ringText</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>
    1130             <span class="n">ringThick</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">thick</span><span class="p">)),</span>
    1131                 <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>
    1132             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ringThick</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>
    1133             <span class="n">ringThick</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">OnRingThickness</span><span class="p">)</span>
    1134             <span class="n">ringThick</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">OnRingThickness</span><span class="p">)</span>
    1135             <span class="n">ringIds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ringThick</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
    1136             <span class="n">ringDelete</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;delete?&#39;</span><span class="p">)</span>
    1137             <span class="n">ringDelete</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">OnDeleteRing</span><span class="p">)</span>
    1138             <span class="n">delRingId</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ringDelete</span><span class="p">)</span>
    1139             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ringDelete</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>
     1230        <span class="k">for</span> <span class="n">ring</span> <span class="ow">in</span> <span class="n">rings</span><span class="p">:</span>
     1231            <span class="k">if</span> <span class="n">ring</span><span class="p">:</span>
     1232                <span class="n">tth</span><span class="p">,</span><span class="n">thick</span> <span class="o">=</span> <span class="n">ring</span>
     1233                <span class="n">ringText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">tth</span><span class="p">)),</span>
     1234                    <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
     1235                <span class="n">ringText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
     1236                <span class="n">ringText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
     1237                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ringText</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>
     1238                <span class="n">ringThick</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">thick</span><span class="p">)),</span>
     1239                    <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>
     1240                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ringThick</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>
     1241                <span class="n">ringThick</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">OnRingThickness</span><span class="p">)</span>
     1242                <span class="n">ringThick</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">OnRingThickness</span><span class="p">)</span>
     1243                <span class="n">ringIds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ringThick</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
     1244                <span class="n">ringDelete</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;delete?&#39;</span><span class="p">)</span>
     1245                <span class="n">ringDelete</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">OnDeleteRing</span><span class="p">)</span>
     1246                <span class="n">delRingId</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ringDelete</span><span class="p">)</span>
     1247                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ringDelete</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>
    11401248        <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">littleSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,)</span>
    11411249    <span class="n">arcIds</span> <span class="o">=</span> <span class="p">[]</span>
     
    11551263            <span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    11561264        <span class="n">littleSizer</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>
    1157         <span class="k">for</span> <span class="n">tth</span><span class="p">,</span><span class="n">azimuth</span><span class="p">,</span><span class="n">thick</span> <span class="ow">in</span> <span class="n">arcs</span><span class="p">:</span>
    1158             <span class="n">arcText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">tth</span><span class="p">)),</span>
    1159                 <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
    1160             <span class="n">arcText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
    1161             <span class="n">arcText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
    1162             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">arcText</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>
    1163             <span class="n">azmText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%d</span><span class="s">,</span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">azimuth</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">azimuth</span><span class="p">[</span><span class="mi">1</span><span class="p">])),</span>
    1164                 <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
    1165             <span class="n">azmText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
    1166             <span class="n">azmText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
    1167             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">azmText</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>
    1168             <span class="n">arcThick</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">thick</span><span class="p">)),</span>
    1169                 <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>
    1170             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">arcThick</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>
    1171             <span class="n">arcThick</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">OnArcThickness</span><span class="p">)</span>
    1172             <span class="n">arcThick</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">OnArcThickness</span><span class="p">)</span>
    1173             <span class="n">arcIds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arcThick</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
    1174             <span class="n">arcDelete</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;delete?&#39;</span><span class="p">)</span>
    1175             <span class="n">arcDelete</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">OnDeleteArc</span><span class="p">)</span>
    1176             <span class="n">delArcId</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arcDelete</span><span class="p">)</span>
    1177             <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">arcDelete</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>
     1265        <span class="k">for</span> <span class="n">arc</span> <span class="ow">in</span> <span class="n">arcs</span><span class="p">:</span>
     1266            <span class="k">if</span> <span class="n">arc</span><span class="p">:</span>
     1267                <span class="n">tth</span><span class="p">,</span><span class="n">azimuth</span><span class="p">,</span><span class="n">thick</span> <span class="o">=</span> <span class="n">arc</span>
     1268                <span class="n">arcText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">tth</span><span class="p">)),</span>
     1269                    <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
     1270                <span class="n">arcText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
     1271                <span class="n">arcText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
     1272                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">arcText</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>
     1273                <span class="n">azmText</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%d</span><span class="s">,</span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">azimuth</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">azimuth</span><span class="p">[</span><span class="mi">1</span><span class="p">])),</span>
     1274                    <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_READONLY</span><span class="p">)</span>
     1275                <span class="n">azmText</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">VERY_LIGHT_GREY</span><span class="p">)</span>
     1276                <span class="n">azmText</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_ENTER_WINDOW</span><span class="p">,</span><span class="n">OnTextMsg</span><span class="p">)</span>
     1277                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">azmText</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>
     1278                <span class="n">arcThick</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</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">thick</span><span class="p">)),</span>
     1279                    <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>
     1280                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">arcThick</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>
     1281                <span class="n">arcThick</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">OnArcThickness</span><span class="p">)</span>
     1282                <span class="n">arcThick</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">OnArcThickness</span><span class="p">)</span>
     1283                <span class="n">arcIds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arcThick</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
     1284                <span class="n">arcDelete</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;delete?&#39;</span><span class="p">)</span>
     1285                <span class="n">arcDelete</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">OnDeleteArc</span><span class="p">)</span>
     1286                <span class="n">delArcId</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arcDelete</span><span class="p">)</span>
     1287                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">arcDelete</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>
    11781288        <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">littleSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,)</span>
    11791289    <span class="n">polyIds</span> <span class="o">=</span> <span class="p">[]</span>
    11801290    <span class="n">delPolyId</span> <span class="o">=</span> <span class="p">[]</span>
     1291    <span class="n">delFrameId</span> <span class="o">=</span> <span class="p">[]</span>
    11811292    <span class="k">if</span> <span class="n">polygons</span><span class="p">:</span>
    11821293        <span class="n">littleSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FlexGridSizer</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">polygons</span><span class="p">)</span><span class="o">+</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
     
    11961307                <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">polyDelete</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>
    11971308        <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">littleSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,)</span>
     1309    <span class="k">if</span> <span class="n">frame</span><span class="p">:</span>
     1310        <span class="n">littleSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FlexGridSizer</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
     1311        <span class="n">littleSizer</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; Frame mask:&#39;</span><span class="p">),</span><span class="mi">0</span><span class="p">,</span>
     1312            <span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
     1313        <span class="n">littleSizer</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>
     1314        <span class="n">frameList</span> <span class="o">=</span> <span class="p">[]</span>
     1315        <span class="k">for</span> <span class="n">x</span><span class="p">,</span><span class="n">y</span> <span class="ow">in</span> <span class="n">frame</span><span class="p">:</span>
     1316            <span class="n">frameList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.2f</span><span class="s">, </span><span class="si">%.2f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">))</span>
     1317        <span class="n">frameText</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">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="n">frameList</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">frameList</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">CB_READONLY</span><span class="p">)</span>
     1318        <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">frameText</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>
     1319        <span class="n">frameDelete</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">parent</span><span class="o">=</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;delete?&#39;</span><span class="p">)</span>
     1320        <span class="n">frameDelete</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">OnDeleteFrame</span><span class="p">)</span>
     1321        <span class="n">delFrameId</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">frameDelete</span><span class="p">)</span>
     1322        <span class="n">littleSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">frameDelete</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>
     1323        <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">littleSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,)</span>
    11981324    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>   
    11991325    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">mainSizer</span><span class="p">)</span>
    12001326    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="o">.</span><span class="n">SetSize</span><span class="p">(</span><span class="n">mainSizer</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="p">))</span>
    1201     <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">setSizePosLeft</span><span class="p">(</span><span class="n">mainSizer</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="p">))</span>   
     1327    <span class="n">Size</span> <span class="o">=</span> <span class="n">mainSizer</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="p">)</span>
     1328    <span class="n">Size</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mi">450</span>
     1329    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">setSizePosLeft</span><span class="p">(</span><span class="n">Size</span><span class="p">)</span>   
    12021330
    12031331<span class="c">################################################################################</span>
Note: See TracChangeset for help on using the changeset viewer.